Requesting Data


Request Futures 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 Futures dataset listing. To trade Futures live, you can use the QuantConnect data provider or one of the brokerage data providers.

Create Subscriptions

Before you can subscribe to a Futures contract, you must get the contract Symbolsymbol.

Get Contract Symbols

To get Futures contract Symbol objects, call the CreateFuturecreate_future method or use the FutureChainProviderfuture_chain_provider. If you use the CreateFuturecreate_future method, you need to know the specific contract details.

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

If you use the FutureChainProviderfuture_chain_provider, you need to create the continuous contract Symbol of the Future. The GetFutureContractListget_future_contract_list method of FutureChainProviderfuture_chain_provider returns a list of Symbol objects that reference the available Futures contracts for a given underlying Future on a given date.

var continuousFutureSymbol = QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME);
var contractSymbols = FutureChainProvider.GetFutureContractList(continuousFutureSymbol, Time);
_contractSymbol = contractSymbols.OrderByDescending(symbol => symbol.ID.Date).Last();
continuous_future_symbol = Symbol.create(Futures.Indices.SP500E_MINI, SecurityType.FUTURE, Market.CME)
contract_symbols = self.future_chain_provider.get_future_contract_list(continuous_future_symbol, self.time)
self._contract_symbol = sorted(contract_symbols, key=lambda symbol: symbol.id.date)[0]

Subscribe to Contracts

To create a Futures contract subscription, pass the contract Symbolsymbol to the AddFutureContractadd_future_contract method. Save a reference to the contract  Symbolsymbol so you can easily access the contract in the Futures Chains that LEAN passes to the OnDataon_data method.


The AddFutureContractadd_future_contract method creates a subscription for a single Future contract and adds it to your user-defined universe. To create a dynamic universe of Futures contracts, add a Futures universe or a Futures Universe Selection model.

Warm Up Contract Prices

If you subscribe to a Futures contract with AddFutureContractadd_future_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 Futures dataset, see Supported Assets.


The following table shows the available resolutions and data formats for Futures subscriptions:

ResolutionTradeBarQuoteBarTrade TickQuote Tick
TickTICKgreen checkgreen check
SecondSECONDgreen checkgreen check
MinuteMINUTEgreen checkgreen check
HourHOURgreen checkgreen check
DailyDAILYgreen checkgreen check

The default resolution for Futures contract subscriptions is Resolution.MinuteResolution.MINUTE. To change the resolution, pass a resolution argument to the AddFutureContractadd_future_contract method.

AddFutureContract(_contractSymbol, Resolution.Daily);
self.add_future_contract(self._contract_symbol, Resolution.DAILY)

To create custom resolution periods, see Consolidating Data.

Supported Markets

The following Market enumeration members are available for Futures:

Historical data for backtesting is unavailable for ICE, INDIA, SGX and NYSELIFFE. In live trading, LEAN sources this data from your brokerage or a third-party data provider.

You don't need to pass a market argument to the AddFutureContractadd_future_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.

AddFutureContract(_contractSymbol, fillForward: false);
self.add_future_contract(self._contract_symbol, fill_forward=False)

Margin and Leverage

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

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.

AddFutureContract(_contractSymbol, extendedMarketHours: true);
self.add_future_contract(self._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.

In general, we model most Futures market hours with the following segments:

Market SegmentTime
Pre-market00:00:00 to 09:30:00
Market09:30:00 to 17:00:00
Post-market18:00:00 to 00:00:00

We model it this way because some Futures, like VIX, have pre- and post-market hours, so we standardized it. With this segmentation, if you set a Scheduled Events for the market open, it's set for 9:30 AM instead of midnight.

Continuous Contracts

A continuous Futures contract represents a single contract that maps to other contracts over time as the rollover rules are met. For more information about continuous Futures contracts, see Continuous Contracts.

Data Normalization

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

The following data normalization modes are available for continuous Futures contracts:


The AddFutureContractadd_future_contract method returns a Future object, which have the following properties:

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: