/// <summary> /// Gets <see cref="FutureHistory"/> object for a given symbol, date and resolution /// </summary> /// <param name="symbol">The symbol to retrieve historical future data for</param> /// <param name="date">Date of the data</param> /// <param name="resolution">The resolution to request</param> /// <returns>A <see cref="FutureHistory"/> object that contains historical future data.</returns> public FutureHistory GetFutureHistory(Symbol symbol, DateTime date, Resolution? resolution = null) { SetStartDate(date.AddDays(1)); var future = Securities[symbol] as Future; var provider = new BacktestingFutureChainProvider(); var allSymbols = provider.GetFutureContractList(future.Symbol, date); var requests = future.ContractFilter.Filter(new FutureFilterUniverse(allSymbols, new Tick { Time = date })) .Select(x => new HistoryRequest(date.AddDays(-1), date, typeof(QuoteBar), x, resolution ?? future.Resolution, future.Exchange.Hours, MarketHoursDatabase.FromDataFolder().GetDataTimeZone(future.Symbol.ID.Market, future.Symbol, future.Type), Resolution.Minute, future.IsExtendedMarketHours, future.IsCustomData(), DataNormalizationMode.Raw, LeanData.GetCommonTickTypeForCommonDataTypes(typeof(QuoteBar), future.Type)) ); return new FutureHistory(HistoryProvider.GetHistory(requests, TimeZone).Memoize()); }
public void FuturesOptionsWithUnderlyingContractMonthMappedByRuleResolvesUnderlyingGetLeanSymbol(int year, int month, int day) { var futuresChainProvider = new BacktestingFutureChainProvider(TestGlobals.DataProvider); var mapper = new InteractiveBrokersSymbolMapper(TestGlobals.MapFileProvider); var expectedUnderlyingSymbol = Symbol.CreateFuture("GC", Market.COMEX, new DateTime(2021, 4, 28)); var futureOption = mapper.GetLeanSymbol("OG", SecurityType.FutureOption, Market.COMEX, new DateTime(year, month, day)); Assert.AreEqual(expectedUnderlyingSymbol, futureOption.Underlying); }
public void SetUp() { // Store initial Log Handler _logHandler = Log.LogHandler; _provider = new BacktestingFutureChainProvider(); }
public void SetUp() { // Store initial Log Handler _logHandler = Log.LogHandler; _provider = new BacktestingFutureChainProvider(TestGlobals.DataCacheProvider); }
public void SetUp() { _logHandler = Log.LogHandler; _provider = new BacktestingFutureChainProvider(); }