public IEnumerable<IStockRealTime> GetLatest(IEnumerable<string> stockCodes) { List<RealTimeItem> result = new List<RealTimeItem>(); foreach(string code in stockCodes) { string filePath = string.Empty; if (PathHelper.GetLatestFilePath(code, ref filePath)) { var file = new RealTimeFile(filePath); result.Add(file.Read(file.Header.DataCount - 1)); } } return result.Cast<IStockRealTime>(); }
public IEnumerable<IStockRealTime> GetData(string stockCode, DateTime startDate, DateTime endDate) { List<string> pathList = PathHelper.GetFilePath(stockCode, startDate, endDate).ToList(); List<RealTimeItem> result = new List<RealTimeItem>(); foreach(string path in pathList) { if(File.Exists(path)) { var file = new RealTimeFile(path); result.AddRange(file.ReadAll()); } } return result.Cast<IStockRealTime>(); }