Future Options

Requesting Data

Introduction

Request Future Options data in your algorithm to receive a feed of contract prices in the OnDataon_data method. For more information about the specific dataset we use for backtests, see the US Future Options dataset listing. To trade Future Options live, you can use the QuantConnect data feed or one of the brokerage data providers. We currently only support American-style Options for Future Options.

Create Subscriptions

Before you can subscribe to a Future Option contract, you may configure the underlying volatility model and you must get the contract Symbolsymbol.

Configure the Underlying Futures Contract

In most cases, you should subscribe to the underlying Futures contract before you subscribe to a Futures Option contract. If you don't, LEAN automatically subscribes to the underlying Futures contract with the following settings:

SettingValue
Fill forwardSame as the Option contract
Leverage0
Extended Market HoursSame as the Option contract

In this case, you still need the Futures contract Symbolsymbol.

to subscribe to Futures Option contracts. If you don't have access to it, create it.

_futureContractSymbol = QuantConnect.Symbol.CreateFuture(Futures.Indices.SP500EMini,
    Market.CME, new DateTime(2022, 6, 17));
self.future_contract_symbol = Symbol.create_future(Futures.Indices.SP500E_MINI,
    Market.CME, datetime(2022, 6, 17))

For more information about getting the Symbol of Futures contracts, see Create Subscriptions.

To override the initial guess of implied volatility, set and warm up the underlying volatility model.

Get Contract Symbols

To subscribe to a Future Option contract, you need the contract Symbol. You can get the contract Symbolsymbol from the CreateOptioncreate_option method or from the OptionChainProvideroption_chain_provider. If you use the CreateOptioncreate_option method, you need to provide the contract details.

_optionContractSymbol = QuantConnect.Symbol.CreateOption(_futureContractSymbol,
    Market.CME, OptionStyle.American, OptionRight.Call, 3600, new DateTime(2022, 6, 17))
self.option_contract_symbol = Symbol.create_option(self.future_contract_symbol,
    Market.CME, OptionStyle.AMERICAN, OptionRight.CALL, 3600, datetime(2022, 6, 17))

Another way to get a Future Option contract Symbol is to use the OptionChainProvideroption_chain_provider. The GetOptionContractListget_option_contract_list method of OptionChainProvideroption_chain_provider returns a list of Symbol objects that reference the available Option contracts for a given underlying Future contract on a given date. The Symbol you pass to the method can reference any of the following Futures contracts:

To filter and select contracts that the GetOptionContractListget_option_contract_list method returns, you can use the following properties of each Symbol object:

PropertyDescription
ID.Dateid.dateThe expiration date of the contract.
ID.StrikePriceid.strike_priceThe strike price of the contract.
ID.OptionRightid.option_right The contract type. The OptionRight enumeration has the following members:
ID.OptionStyleid.option_style The contract style. The OptionStyle enumeration has the following members:
We currently only support American-style Options for Future Options.
var optionContractSymbols = OptionChainProvider.GetOptionContractList(_futureContractSymbol, Time);
var expiry = optionContractSymbols.Select(symbol => symbol.ID.Date).Min();
var filteredSymbols = optionContractSymbols.Where(symbol => symbol.ID.Date == expiry && symbol.ID.OptionRight == OptionRight.Call);
_optionContractSymbol = filteredSymbols.OrderByDescending(symbol => symbol.ID.StrikePrice).Last();
option_contract_symbols = self.option_chain_provider.get_option_contract_list(self.future_contract_symbol, self.time)
expiry = min([symbol.id.date for symbol in option_contract_symbols])
filtered_symbols = [symbol for symbol in option_contract_symbols if symbol.id.date == expiry and symbol.id.option_right == OptionRight.CALL]
self.option_contract_symbol = sorted(filtered_symbols, key=lambda symbol: symbol.id.strike_price)[0]

Subscribe to Contracts

To create a Future Option contract subscription, pass the contract Symbolsymbol to the AddFutureOptionContractadd_future_option_contract method. Save a reference to the contract Symbolsymbol so you can easily access the Option contract in the OptionChain that LEAN passes to the OnDataon_data method. To override the default pricing model of the Option, set a pricing model.

var option = AddFutureOptionContract(_optionContractSymbol);
option.PriceModel = OptionPriceModels.BinomialCoxRossRubinstein();
option = self.add_future_option_contract(self.option_contract_symbol)
option.price_model = OptionPriceModels.binomial_cox_ross_rubinstein()

The AddFutureOptionContractadd_future_option_contract method creates a subscription for a single Option contract and adds it to your user-defined universe. To create a dynamic universe of Future Option contracts, add a Future Options universe.

Warm Up Contract Prices

If you subscribe to a Future Option contract with AddFutureOptionContractadd_future_option_contract, you'll need to wait until the next Slice to receive data and trade the contract. To trade the contract in the same time step you subscribe to the contract, set the current price of the contract in a security initializer.

var seeder = new FuncSecuritySeeder(GetLastKnownPrices);
SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel, seeder));
seeder = FuncSecuritySeeder(self.get_last_known_prices)
self.set_security_initializer(BrokerageModelSecurityInitializer(self.brokerage_model, seeder))

Supported Assets

To view the supported assets in the US Future Options dataset, see Supported Assets.

Resolutions

The following table shows the available resolutions and data formats for Future Option contract subscriptions:

ResolutionTradeBarQuoteBarTrade TickQuote Tick
TickTICK

SecondSECOND

MinuteMINUTEgreen checkgreen check
HourHOURgreen checkgreen check
DailyDAILYgreen checkgreen check

There is only one resolution option, so you don't need to pass a resolution argument to the AddFutureOptionContractadd_future_option_contract method.

AddFutureOptionContract(_optionContractSymbol, Resolution.Minute);
self.add_future_option_contract(self.option_contract_symbol, Resolution.MINUTE)

To create custom resolution periods, see Consolidating Data.

Supported Markets

The following Market enumeration members are available for Future Options:

You don't need to pass a Market argument to the AddFutureOptionContractadd_future_option_contract method because the contract Symbol already contains the market.

Fill Forward

Fill forward means if there is no data point for the current slice, LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForwardfill_forward argument to false when you create the security subscription.

AddFutureOptionContract(_optionContractSymbol, fillForward: false);
self.add_future_option_contract(self.option_contract_symbol, fill_forward=False)

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. Future Options are already leveraged products, so you can't change their leverage.

Extended Market Hours

By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the extendedMarketHoursextended_market_hours argument when you create the security subscription.

AddFutureOptionContract(_optionContractSymbol, extendedMarketHours: true);
self.add_future_option_contract(self.option_contract_symbol, extended_market_hours=True)

You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.

To view the schedule of regular and extended market hours, see Market Hours.

Data Normalization

The data normalization mode doesn't affect the data that LEAN passes to OnDataon_data or the data from history request. If you change the data normalization mode, it won't change the outcome.

Remove Subscriptions

To remove a contract subscription that you created with AddFutureOptionContract, call the RemoveOptionContractremove_option_contract method. This method is an alias for RemoveSecurityremove_security.

RemoveOptionContract(_optionContractSymbol);
self.remove_option_contract(self.option_contract_symbol)

The RemoveOptionContractremove_option_contract method cancels your open orders for the contract and liquidates your holdings.

Properties

The AddFutureOptionContract method returns an Option object, which have the following properties:

Helper Methods

The Option object provides methods you can use for basic calculations. These methods require the underlying price. To get the Option object and the Security object for its underlying in any function, use the Option Symbolsymbol to access the value in the Securitiessecurities object.

var option = Securities[_optionContractSymbol];
var underlying = Securities[_optionContractSymbol.Underlying];
var underlyingPrice = underlying.Price;
option = self.securities[self.option_contract_symbol]
underlying = self.securities[self.option_contract_symbol.underlying]
underlying_price = underlying.price

To get the Option payoff, call the GetPayOffget_pay_off method.

var payOff = option.GetPayOff(underlyingPrice);
pay_off = option.get_pay_off(underlying_price)

To get the Option intrinsic value, call the GetIntrinsicValueget_intrinsic_value method.

var intrinsicValue = option.GetIntrinsicValue(underlyingPrice);
intrinsic_value = option.get_intrinsic_value(underlying_price)

To get the Option out-of-the-money amount, call the OutOfTheMoneyAmountout_of_the_money_amount method.

var otmAmount = option.OutOfTheMoneyAmount(underlyingPrice);
otm_amount = option.out_of_the_money_amount(underlying_price)

To check whether the Option can be automatic exercised, call the IsAutoExercisedis_auto_exercised method.

var isAutoExercised = option.IsAutoExercised(underlyingPrice);
is_auto_exercised = option.is_auto_exercised(underlying_price)

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: