AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
![]() ![]() ![]() Routine for downloading Yahoo! Finance data as a tuple consisting of a symbol name and data matrix. TotalSeconds let GetHistoricalData symbol ( startDate : DateTime) ( endDate : DateTime) = let url1 = new Uri( "" + symbol + "/history?p=" + symbol) Let DateTimeToUnixTimestamp ( dateTime : DateTime) = RegularExpressions let UnixTimestampToDateTime unixTimeStamp = DateTime( 1970, 1, 1, 0, 0, 0, 0, DateTimeKind. Create ( url1) :?> HttpWebRequest request. Let regexCrumb = new Regex( "CrumbStore \" :", CookieContainer HttpWebResponse let cookie = response. ![]() Let url2 = "" + symbol + "?period1=" + Math. ![]() Round( DateTimeToUnixTimestamp( startDate), 0). Round( DateTimeToUnixTimestamp( endDate), 0). ToString() + "&interval=1d&events=history&crumb=" + crumb. | _ -> printfn "Symbol %s download failed, retrying." symbol Array. You just have to identify the Yahoo Symbols, stick in the Yahoo Tags that define the info you want, Here's a spreadsheet that'll download the Yahoo data according to the tags that you specify: Whereas, to get the data already in a spreadsheet (so you can play it), Percent Change From 50-day Moving Averageįor example, if y'all copy and paste this URL into your browser address: Percent Change From 200-day Moving Average Where some special tags are (thanks to Mike):Įrror Indication (returned for symbol changed / invalid) Here's a neat way to download stock data from Yahoo, perhaps into a spreadsheetĪ BUNCH of STOCK SYMBOLS separated by "+" &f= a bunch of special tags empty printfn "Symbol download %s succeeded.Yahoo data download Downloading Yahoo data thanks to M.Kishinevsky and M. You will also want to reformat the columns so that prices don't display as dates (so you know what you're getting), then click the Download Data button. To download the spreadsheet, click on the picture above.ĭata is downloaded in. ![]()
0 Comments
Read More
Leave a Reply. |