public void AddFutureOptionContractNonEquityOption() { // Adds an option contract containing an underlying future contract. // We test to make sure that the security returned is a specific option // contract and with the future as the underlying. var algo = new QCAlgorithm(); algo.SubscriptionManager.SetDataManager(new DataManagerStub(algo)); var underlying = algo.AddFutureContract( Symbol.CreateFuture("ES", Market.CME, new DateTime(2021, 3, 19)), Resolution.Minute); var futureOptionContract = algo.AddFutureOptionContract( Symbol.CreateOption(underlying.Symbol, Market.CME, OptionStyle.American, OptionRight.Call, 2550m, new DateTime(2021, 3, 19)), Resolution.Minute); Assert.AreEqual(underlying.Symbol, futureOptionContract.Symbol.Underlying); Assert.AreEqual(underlying, futureOptionContract.Underlying); Assert.IsFalse(underlying.Symbol.IsCanonical()); Assert.IsFalse(futureOptionContract.Symbol.IsCanonical()); }
/// <summary> /// Creates and adds a new single <see cref="Future"/> contract to the algorithm /// </summary> /// <param name="symbol">The futures contract symbol</param> /// <param name="resolution">The <see cref="Resolution"/> of market data, Tick, Second, Minute, Hour, or Daily. Default is <see cref="Resolution.Minute"/></param> /// <param name="fillDataForward">If true, returns the last available data even if none in that timeslice. Default is <value>true</value></param> /// <param name="leverage">The requested leverage for this equity. Default is set by <see cref="SecurityInitializer"/></param> /// <returns>The new <see cref="Future"/> security</returns> public Future AddFutureContract(Symbol symbol, Resolution resolution = Resolution.Minute, bool fillDataForward = true, decimal leverage = 0m) { return(_baseAlgorithm.AddFutureContract(symbol, resolution, fillDataForward, leverage)); }