FAQ |
Calendar |
![]() |
|
Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman. |
![]() |
|
Thread Tools |
#1
|
|||
|
|||
![]()
Mari kita membuat stock quotes, historic data, rates of exchanges dan technical analysis charts dari Yahoo! Finance secara mudah dan nggak perlu lagi pakai cara lama (pakai convert CSV dsb)... Cukup komunikasi dengan Yahoo! Finance API... ![]() Yang dibutuhkan untuk programming di .Net adalah library untuk request dan download data dari Yahoo! Finance. Cara pakai : Code: Imports YahooFinanceManaged Features Library : * ID/symbol lookup * Downloading daytrading quotes of financial products (stocks, indices, funds, ETFs, futures) * Downloading currency exchange rate quotes * Downloading historical quotes of financial products * Downloading technical analysing chart images * Downloading sector, industry and company informations * Simple synchronous or multiple asynchronous downloading * Up to 86 quote properties * 146 currencies * 5 metals * 16 servers * Informations of more than 80 stock indices * Informations of about 77 stock exchanges * Exchange rate calculator * Data import and export with CSV, XML and System.Data.DataTable * RSS Feed support Class DownloadBase terdiri atas Class IDSearchDownload, QuotesDownload, HistQuotesDownload, ExchangeRateDownload, MarketDownload dan OnlineCheck. Contoh Penggunaan : ID Search ![]() Code: Dim keyword As String = "dow jones" Dim search As New YahooFinanceManaged.NonAPI.IDSearchDownload Dim results() As YahooFinanceManaged.Data.IDSearchResult = search.Download(options) For Each result As YahooFinanceManaged.Data.IDSearchResult In results Debug.Write(result.ID) Debug.Write(" - ") Debug.WriteLine(result.Name) Next Alphabetical List ![]() Code: VB.NET List Range Dim dl As New YahooFinanceManaged.NonAPI.IDListDownload Dim server As YahooFinanceManaged.Enums.Server = YahooFinanceManaged.Enums.Server.Germany Dim country As YahooFinanceManaged.Enums.Country = YahooFinanceManaged.Enums.Country.Germany Dim ranges() As YahooFinanceManaged.Data.IDListRange = dl.DownloadAlphabetRange(country, server) For Each r As YahooFinanceManaged.Data.IDListRange In ranges Debug.WriteLine(r.Value) Next '4' 'A' 'B' 'C' 'D' '...' List SubRange Dim range As YahooFinanceManaged.Data.IDListRange = ranges(1) 'A' Dim subRanges() As YahooFinanceManaged.Data.IDListSubRange = dl.DownloadAlphabetSubRange(range) For Each sr As YahooFinanceManaged.Data.IDListSubRange In subRanges Debug.WriteLine(sr.Value) Next 'A - AD' 'AD - AL' 'AL - AS' 'AT - AZ' ID Download Dim subRange As YahooFinanceManaged.Data.IDListSubRange = subRanges(0) 'A - AD' Dim results() As YahooFinanceManaged.Data.IDSearchResult = dl.DownloadCompanyList(subRange) For Each res As YahooFinanceManaged.Data.IDSearchResult In results Debug.WriteLine(res.ID) Next 'LUMG.DE' 'ASEG.D' 'AAQG.DE' 'ARLG.DE' 'ENMG.DE' '...' Quotes Download ![]() ![]() Code: Dim ids() As String = New String() {"MSFT", "GOOG", "YHOO"} 'or' 'Dim search As New YahooFinanceManaged.API.IDSearchDownload' 'Dim ids() As YahooFinanceManaged.Data.IDSearchResult = search.Download("dow jones")' Dim properties() As YahooFinanceManaged.Enums.QuoteProperty = New YahooFinanceManaged.Enums.QuoteProperty() _ {YahooFinanceManaged.Enums.QuoteProperty.Name, _ YahooFinanceManaged.Enums.QuoteProperty.Symbol, _ YahooFinanceManaged.Enums.QuoteProperty.LastTradeP riceOnly} Dim server As YahooFinanceManaged.Enums.Server = YahooFinanceManaged.Enums.Server.YQL Dim qDl As New YahooFinanceManaged.API.QuotesDownload Dim quotes() As YahooFinanceManaged.Data.QuoteData = qDl.Download(ids, properties, server) For Each quote As YahooFinanceManaged.Data.QuoteData In quotes Debug.Write(quote.ID) Debug.Write(" - ") Debug.WriteLine(quote(YahooFinanceManaged.Enums.Qu oteProperty.LastTradePriceOnly)) Next Historical Quotes Download ![]() ![]() Code: Dim id As String = "BAS.DE" Dim hqDl As New YahooFinanceManaged.API.HistQuotesDownload Dim histQuotes() As YahooFinanceManaged.Data.HistQuoteData = hqDl.Download(id, #1/1/2000#, #1/1/2010#, YahooFinanceManaged.Enums.HistQuotesInterval.Weekl y) For Each histQuote As YahooFinanceManaged.Data.HistQuoteData In histQuotes Debug.Write(histQuote.Open) Debug.Write(" - ") Debug.WriteLine(histQuote.Close) Next Image Download ![]() ![]() Code: Dim options As New YahooFinanceManaged.API.ImageDownloadOptions options.ID = "BAS.DE" options.Server = YahooFinanceManaged.Enums.Server.USA options.ImageSize = YahooFinanceManaged.Enums.ChartImageSize.Large options.TimeSpan = YahooFinanceManaged.Enums.ChartTimeSpan.c2Y options.Type = YahooFinanceManaged.Enums.ChartType.Candle options.Scale = YahooFinanceManaged.Enums.ChartScale.Logarithmic options.MovingAverages.Add(YahooFinanceManaged.Enu ms.MovingAverageInterval.m20) options.MovingAverages.Add(YahooFinanceManaged.Enu ms.MovingAverageInterval.m200) options.ComparingIDs.Add("^GDAXI") Dim imgDl As New YahooFinanceManaged.API.ImageDownload Dim imgStream As System.IO.Stream = imgDl.Download(options) Dim image As System.Drawing.Image = System.Drawing.Image.FromStream(imgStream) YCurrencyID ![]() Code: Dim id As New YahooFinanceManaged.Support.YCurrencyID(YahooFinan ceManaged.Enums.Currency.EUR, YahooFinanceManaged.Enums.Currency.USD) Debug.WriteLine(id.ID) 'EURUSD=X' Debug.WriteLine(id.BaseName) 'Euro' Debug.WriteLine(id.DepName) 'U.S. Dollar' Debug.WriteLine(id.DisplayName) 'Euro to U.S. Dollar' Dim iidInstance As YahooFinanceManaged.Data.IID = id Dim qDl As New YahooFinanceManaged.API.QuotesDownload Dim properties() As YahooFinanceManaged.Enums.QuoteProperty = New YahooFinanceManaged.Enums.QuoteProperty() _ {YahooFinanceManaged.Enums.QuoteProperty.Name, _ YahooFinanceManaged.Enums.QuoteProperty.Symbol, _ YahooFinanceManaged.Enums.QuoteProperty.LastTradeP riceOnly} Dim server As YahooFinanceManaged.Enums.Server = YahooFinanceManaged.Enums.Server.YQL Dim quotes() As YahooFinanceManaged.Data.QuoteData = qDl.Download(id, properties, server) Download Library : Code: http://hot*file..com/dl/45222897/ab2...6_x86.zip.html Download Aplikasi : Code: http://hot*file..com/dl/45223250/ee5...nance.zip.html Mampir Lapak Saya Gan : Butuh Kerjaan Freelance Buat Bertahan Hidup di Jakarta Terkait:
|
![]() |
|
|