public IStockKLine GetLatest(string stockCode) { StockRealTimeApi reader = new StockRealTimeApi(); IStockRealTime realTimeData = reader.GetData(stockCode); if (IsKLineDay(realTimeData)) { return ConvertToDayLine(realTimeData); } else { return null; } }
public IEnumerable<KeyValuePair<string, IStockKLine>> GetLatest(IEnumerable<string> stockCodes) { StockRealTimeApi reader = new StockRealTimeApi(); var realTimeDatas = reader.GetData(stockCodes).ToList(); Dictionary<string, IStockKLine> result = new Dictionary<string, IStockKLine>(); foreach(var item in realTimeDatas) { if (IsKLineDay(item.Value)) { result.Add(item.Key, ConvertToDayLine(item.Value)); } } return result; }