---
title: "Individual Contracts"
description: "Request Futures data in your algorithm to receive a feed of contract prices in the OnData method."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures/requesting-data/individual-contracts
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures/requesting-data/individual-contracts.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/03%20Securities/99%20Asset%20Classes/06%20Futures/01%20Requesting%20Data/02%20Individual%20Contracts
modified: 2026-10-30
index: https://www.quantconnect.com/llms.txt
---

# Individual Contracts

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Securities > [Asset Classes](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes.md) > [Futures](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures.md) > [Requesting Data](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures/requesting-data.md) > Individual Contracts

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

The `add_future_contract` method enables you to add an individual Future contract to your algorithm. To check which contracts are currently available to add to your algorithm, call the `futures_chain` method. If you want to subscribe to a set of contracts instead of individual contracts one-by-one, see [Universes](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures/requesting-data/universes.md).

In most Futures algorithms, a universe is the easier choice. When you call the `set_filter` method, LEAN subscribes to every contract that passes the filter, so you can select the contract you want to trade from the [FuturesChain](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures/handling-data.md#05-Futures-Chains) in the `Slice` without adding it yourself. Use the `add_future_contract` method when you want to manage each contract subscription yourself.

## Create Subscriptions

Before you can subscribe to a Future contract, you must have the underlying Future `Symbol` to get the contract `Symbol`.

```python
class BasicFutureAlgorithm(QCAlgorithm):
    def initialize(self):
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        self._continuous = self.add_future(Futures.Indices.SP_500_E_MINI).symbol
        self._contract_symbol = None

    def on_data(self, data):
        if not self._contract_symbol:
            self._contract_symbol = list(self.futures_chain(self._continuous))[0].symbol
            self.add_future_contract(self._contract_symbol)
```

### Get Contract Symbols

To subscribe to a Future contract, you need the contract `Symbol`. The preferred method to getting Future contract `Symbol` objects is to use the `futures_chain` method. This method returns a `FuturesChain` object, which represent an entire chain of Option contracts for a single underlying security. You can even format the chain data into a DataFrame where each row in the DataFrame represents a single contract. With the chain, sort and filter the data to find the specific contract(s) you want to trade.

```python
# Select the first contract in the chain, which is the front-month contract.
self._contract_symbol = list(self.futures_chain(self._continuous))[0].symbol
```

Alternatively, you can create a Future contract `Symbol` object directly parsing its ticker using the `SymbolRepresentation.parse_future_symbol` method.

```python
# Create the contract Symbol for the December 2025 E-mini S&P 500 Future.
self._contract_symbol = SymbolRepresentation.parse_future_symbol('ESZ25')
# Create the contract Symbol using the 1-digit year format.
self._contract_symbol = SymbolRepresentation.parse_future_symbol('ESZ5')
# To avoid ambiguity, specify the 4-digit year.
self._contract_symbol = SymbolRepresentation.parse_future_symbol('ESZ5', 2015)
```

### Subscribe to Contracts

To create an Future contract subscription, pass the contract `Symbol` to the `add_future_contract` method. Save a reference to the contract `symbol` so you can easily access the Future contract in the [FutureChain](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures/handling-data.md#05-Futures-Chains) that LEAN passes to the `on_data` method. This method returns an `Future` object.

```python
self.add_future_contract(self._contract_symbol)
```

The `add_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 an [Future universe](https://www.quantconnect.com/docs/v2/writing-algorithms/universes/futures.md) or an [Future Universe Selection model](https://www.quantconnect.com/docs/v2/writing-algorithms/algorithm-framework/universe-selection/futures-universes.md).

### Warm Up Contract Prices

If you subscribe to an Future contract with `add_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](https://www.quantconnect.com/docs/v2/writing-algorithms/initialization.md#07-Set-Security-Initializer).

```python
self.settings.seed_initial_prices = True
```

### Supported Assets

To view the supported assets in the Futures dataset, see the [Supported Assets](https://www.quantconnect.com/datasets/algoseek-us-futures).

## Resolutions

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

| Resolution | TradeBar | QuoteBar | Trade Tick | Quote Tick |
| --- | --- | --- | --- | --- |
| `TICK` | Not supported | Not supported | Supported✓ | Supported✓ |
| `SECOND` | Supported✓ | Supported✓ | Not supported | Not supported |
| `MINUTE` | Supported✓ | Supported✓ | Not supported | Not supported |
| `HOUR` | Supported✓ | Supported✓ | Not supported | Not supported |
| `DAILY` | Supported✓ | Supported✓ | Not supported | Not supported |

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

```python
self.add_future_contract(self._contract_symbol, Resolution.DAILY)
```

To create custom resolution periods, see [Consolidating Data](https://www.quantconnect.com/docs/v2/writing-algorithms/consolidating-data/getting-started.md).

## Supported Markets

The following `Market` enumeration members are available for Futures:

*Members of `QuantConnect.Market` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.Market&language=python*

Fields: `CBOT`, `CFE`, `CME`, `COMEX`, `EUREX`, `HKFE`, `ICE`, `INDIA`, `India`, `KRX`, `NYMEX`, `NYSELIFFE`, `SGX`

Historical data for backtesting is unavailable for `ICE`, `INDIA`, `SGX` and `NYSELIFFE`. In live trading, LEAN sources this data from your [brokerage](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/brokerages.md) or a [third-party data provider](https://www.quantconnect.com/docs/v2/writing-algorithms/live-trading/data-providers.md).

You don't need to pass a `market` argument to the `add_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](https://www.quantconnect.com/docs/v2/writing-algorithms/key-concepts/time-modeling/timeslices.md), LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get [stale fills](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/trade-fills/key-concepts.md#06-Stale-Fills) or you may see trade volume as zero.

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

```python
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](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/buying-power.md#08-Default-Behavior).

## 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 `extended_market_hours` argument when you create the security subscription.

```python
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](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures/market-hours.md).

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

| Market Segment | Time |
| --- | --- |
| Pre-market | 00:00:00 to 09:30:00 |
| Market | 09:30:00 to 17:00:00 |
| Post-market | 18: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](https://www.quantconnect.com/docs/v2/writing-algorithms/scheduled-events.md) 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](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures/requesting-data/universes.md#03-Continous-Contracts).

## Data Normalization

The data normalization mode doesn't affect the data that LEAN passes to `on_data` or the data from [history request](https://www.quantconnect.com/docs/v2/writing-algorithms/historical-data/history-requests.md) 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](https://www.quantconnect.com/docs/v2/writing-algorithms/universes/futures.md#12-Continous-Contracts):

*Members of `QuantConnect.DataNormalizationMode` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.DataNormalizationMode&language=python*

Fields: `ForwardPanamaCanal`, `BackwardsPanamaCanal`, `BackwardsRatio`, `FORWARD_PANAMA_CANAL`, `BACKWARDS_PANAMA_CANAL`, `BACKWARDS_RATIO`

## Properties

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

*Members of `QuantConnect.Securities.Future.Future` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.Securities.Future.Future&language=python*

## Examples

The following examples demonstrate common practices for requesting individual Future contract data.

### Example 1: Add the Front-Month Contract

The following algorithm adds the front-month contract, with a two-day buffer, for the E-Mini S&P 500 Future and [plots](https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/plotting-indicators.md) the daily closing price of the contract three days before month end. Then, trade an EMA cross strategy.

```python
class FutureExampleAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)

        # Request the future underlying data for ATM strike selection.
        self._future = self.add_future(
            Futures.Indices.SP_500_E_MINI,
            extended_market_hours=True,
            data_normalization_mode=DataNormalizationMode.BACKWARDS_RATIO,
        ).symbol

        # Create an EMA indicator for trade signal generation.
        self._ema = self.ema(self._future, 20, Resolution.DAILY)
        # Warm up the indicator for immediate readiness to trade with.
        self.warm_up_indicator(self._future, self._ema, Resolution.DAILY)

        # Set a scheduled event to select the option contract periodically.
        self.schedule.on(
            # 3 days offset to select in prior.
            self.date_rules.month_end(3),
            self.time_rules.at(0, 1),
            self.select_contract
        )
        self.select_contract()

    def select_contract(self) -> None:
        # Get all the contracts that are currently tradable.
        chain = self.futures_chain(self._future)
        # Select the front-month contract due to liquidity, with a 2-day buffer to avoid volatility.
        contracts = [c for c in chain if c.expiry >= self.time + timedelta(2)]
        if not contracts:
            return
        contract = contracts[0].symbol
        # Request the Futures contract for trading.
        self._contract_symbol = self.add_future_contract(contract).symbol

    def on_data(self, slice: Slice) -> None:
        # Trade based on updated data.
        bar = slice.bars.get(self._contract_symbol)
        if bar and self.is_market_open(self._contract_symbol):
            # Trade trend-following strategy with EMA cross.
            if bar.close > self._ema.current.value and not self.portfolio[self._future].is_long:
                self.set_holdings(self._contract_symbol, 0.5)
            elif bar.close < self._ema.current.value and not self.portfolio[self._future].is_short:
                self.set_holdings(self._contract_symbol, -0.5)
```
