public void DataUrlTests() { const string expectedUrl = "http://ichart.finance.yahoo.com/table.csv?s=VFIAX&c=2007"; var downloader = new HistoricalDataDownloader("VFIAX", new DateTime(2007, 01, 01)); Assert.AreEqual(expectedUrl, downloader.DataUrl); }
private static async Task BridgeToAsync() { var downloader = new HistoricalDataDownloader("VFIAX", new DateTime(2007, 01, 01)); var rawContent = await downloader.DownloadHistoricalDataAsync(); var vfiaxHist = new TickerCsvParser(rawContent).Parse(); var queryableHistory = TickerHistory(vfiaxHist); var startDate = DateTime.UtcNow.AddYears(-1); var priceOnOrAfterStartDate = queryableHistory.First(pair => pair.Key >= startDate); Console.WriteLine(priceOnOrAfterStartDate.Key + Environment.NewLine + priceOnOrAfterStartDate.Value.AdjustedClose); }