private void CacheStocks() { UpdateCache(GetKey("symbols", "StockSummarys"), () => { List <StockSummary> stocks = Stocks.GetStocksFromYahoo(string.Join(",", Symbols)); Serialize <List <StockSummary> >(GetPath("symbols", "StockSummarys"), stocks); }); }
private void CacheStock(string symbol) { UpdateCache(GetKey(symbol, "StockSummary"), () => { StockDetails stock = Stocks.GetStockFromYahoo(symbol) as StockDetails; Serialize <StockDetails>(GetPath(symbol, "StockSummary"), stock); }); }
private void CacheStockHistory(string symbol, DateTime start, DateTime end) { UpdateCache(GetKey(symbol, "StockHistory"), () => { List <StockSummary> stocks = Stocks.GetStockHistoryFromYahoo(symbol, start, end, "d"); List <StockDetails> stockDetails = new List <StockDetails>(); foreach (StockSummary s in stocks) { stockDetails.Add(s as StockDetails); } Serialize <List <StockDetails> >(GetPath(symbol, "StockHistory"), stockDetails); }); }