/// <summary> /// Get historical data enumerable for a single symbol, type and resolution given this start and end time (in UTC). /// </summary> /// <param name="symbol">Symbol for the data we're looking for.</param> /// <param name="resolution">Resolution of the data request</param> /// <param name="startUtc">Start time of the data in UTC</param> /// <param name="endUtc">End time of the data in UTC</param> /// <returns>Enumerable of base data for this symbol</returns> public IEnumerable <BaseData> Get(Symbol symbol, Resolution resolution, DateTime startUtc, DateTime endUtc) { if (symbol.ID.SecurityType != SecurityType.Equity) { throw new NotSupportedException("SecurityType not available: " + symbol.ID.SecurityType); } if (endUtc < startUtc) { throw new ArgumentException("The end date must be greater or equal than the start date."); } var dataType = resolution == Resolution.Tick ? typeof(Tick) : typeof(TradeBar); return(_fileHistoryProvider.ProcessHistoryRequests( new HistoryRequest( startUtc, endUtc, dataType, symbol, resolution, SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), TimeZones.NewYork, resolution, true, false, DataNormalizationMode.Adjusted, _tickType))); }
/// <summary> /// Get historical data enumerable for a single symbol, type and resolution given this start and end time (in UTC). /// </summary> /// <param name="dataDownloaderGetParameters">model class for passing in parameters for historical data</param> /// <returns>Enumerable of base data for this symbol</returns> public IEnumerable <BaseData> Get(DataDownloaderGetParameters dataDownloaderGetParameters) { var symbol = dataDownloaderGetParameters.Symbol; var resolution = dataDownloaderGetParameters.Resolution; var startUtc = dataDownloaderGetParameters.StartUtc; var endUtc = dataDownloaderGetParameters.EndUtc; var tickType = dataDownloaderGetParameters.TickType; if (tickType == TickType.OpenInterest) { return(Enumerable.Empty <BaseData>()); } if (symbol.ID.SecurityType != SecurityType.Equity) { throw new NotSupportedException("SecurityType not available: " + symbol.ID.SecurityType); } if (endUtc < startUtc) { throw new ArgumentException("The end date must be greater or equal than the start date."); } var dataType = resolution == Resolution.Tick ? typeof(Tick) : typeof(TradeBar); return(_fileHistoryProvider.ProcessHistoryRequests( new HistoryRequest( startUtc, endUtc, dataType, symbol, resolution, SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), TimeZones.NewYork, resolution, true, false, DataNormalizationMode.Adjusted, tickType))); }