book
Checkout our new book! Hands on AI Trading with Python, QuantConnect, and AWS Learn More arrow

QuantConnect

US Future Option Universe

Introduction

The US Future Option Universe dataset by QuantConnect lists the available US Future Options contracts and the current open interest. The data covers 16 Monthly Future contracts, starts in January 2012, and is delivered on a daily update frequency. This dataset is created by monitoring the trading activity on the CME, CBOT, NYMEX, and COMEX markets.

The US Future Option Universe dataset depends on the US Future Universe dataset because the US Future Universe dataset contains the universe of underlying Futures contracts. This dataset also depends on the US Futures Security Master dataset because the US Futures Security Master dataset contains information on symbol changes of the contracts.

This dataset does not contain market data. For market data, see US Future Options by AlgoSeek.

For more information about the US Future Option Universe dataset, including CLI commands and pricing, see the dataset listing.

About the Provider

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.

Getting Started

The following snippet demonstrates how to request data from the US Future Options Universe dataset:

future = self.add_future(Futures.Metals.GOLD, Resolution.MINUTE)
future.set_filter(0, 90)
self.add_future_option(future.symbol, lambda universe: universe.strikes(-1, 1))
var future = AddFuture(Futures.Metals.Gold, Resolution.Minute);
future.SetFilter(0, 90);
AddFutureOption(future.Symbol, universe => universe.Strikes(-1, 1));

Data Summary

The following table describes the dataset properties:

PropertyValue
Start DateJanuary 2012
Asset Coverage16 Monthly Future Contracts. Standard expires only. No weeklies or 0DTE contracts.
Data DensityDense
ResolutionDaily
TimezoneNew York
Market HoursRegular and Extended

Requesting Data

To add US Future Options Universe data to your algorithm, call the AddFutureOptionadd_future_option method. To define which contracts should be in your universe, specify the filter when requesting the Future Option data.

The AddFutureOptionadd_future_option method provides a daily stream of Option chain data. To get the most recent daily chain, call the OptionChainoption_chain method with the underlying Future Symbol. The OptionChainoption_chain method returns data on all the tradable contracts, not just the contracts that pass your universe filter.

class USFutureOptionsDataAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2020, 6, 1)
        self.set_end_date(2021, 6, 1)
        self.set_cash(100000)
        self.universe_settings.asynchronous = True
        
        self.future = self.add_future(Futures.Metals.GOLD, Resolution.MINUTE)
        self.future.set_filter(0, 90)
        # Set our strike/expiry filter for this option chain
        self.add_future_option(self.future.symbol, self._option_filter)

    def on_data(self, slice: Slice) -> None:
        # Get the entire Option chain for the current day.
        symbol = Symbol.create_canonical_option(self.future.mapped)
        chain = self.option_chain(symbol, flatten=True).data_frame

    def _option_filter(self, universe: OptionFilterUniverse) -> OptionFilterUniverse:
        # Contracts can be filtered by strike, and expiration
        return universe.strikes(-1, 1)
public class USFutureOptionsDataAlgorithm : QCAlgorithm
{
    private Future _future;
    
    public override void Initialize()
    {
        SetStartDate(2020, 6, 1);
        SetEndDate(2021, 6, 1);
        SetCash(100000);
        UniverseSettings.Asynchronous = True;
        
        _future = AddFuture(Futures.Metals.Gold, Resolution.Minute);
        _future.SetFilter(0, 90);
        // Set our strike/expiry filter for this option chain
        AddFutureOption(_future.Symbol, OptionFilter);
    }

    public override void OnData(Slice slice)
    {
        // Create canonical symbol for the mapped future contract, since option chains are mapped by canonical symbol.
        var symbol = QuantConnect.Symbol.CreateCanonicalOption(_future.Mapped);
        // Get the entire Option chain for the current day.
        var chain = OptionChain(symbol);
    }

    private virtual OptionFilterUniverse OptionFilter(OptionFilterUniverse universe)
    {
        // Contracts can be filtered by strike, and expiration
        return universe.Strikes(-1, 1);
    }
}

The Future resolution must be less than or equal to the Future Option resolution. For example, if you set the Future resolution to minute, then you must set the Future Option resolution to minute, hour, or daily.

For more information about creating US Future Option universes, see Future Options.

Accessing Data

For information about accessing US Future Options Universe data, see Future Options.

Historical Data

You can get historical US Future Options Universe data in an algorithm and the Research Environment.

Historical Data In Algorithms

To get historical US Future Options Universe data in an algorithm, call the History<OptionUniverse>history method with the canonical mapped Future Option Symbol. This method returns data on all of the tradable contracts, not just the contracts that pass your universe filter. If there is no data in the period you request, the history result is empty.

future_option_symbol = Symbol.create_canonical_option(self.future.mapped)
# DataFrame
history_df = self.history(future_option_symbol, timedelta(10), flatten=True)
# OptionUniverse objects
history = self.history[OptionUniverse](future_option_symbol, timedelta(10))
var futureOptionSymbol = QuantConnect.Symbol.CreateCanonicalOption(_future.Mapped);
var history = History<OptionUniverse>(futureOptionSymbol, TimeSpan.FromDays(10)).ToList();

For more information about historical US Future Options Universe data in algorithms, see Historical Data.

Historical Data In Research

To get historical US Future Options Universe data in the Research Environment, call the History<OptionUniverse>history method with the canonical Option Symbol. This method returns data on all of the tradable contracts, not just the contracts that pass your universe filter.

qb = QuantBook()
future = qb.add_future(Futures.Metals.GOLD, Resolution.MINUTE)
future.set_filter(0, 90)
symbol = Symbol.create_canonical_option(future.mapped)
history = qb.history(symbol, datetime(2020, 6, 1), datetime(2020, 6, 5), flatten=True)
var qb = new QuantBook();
var future = qb.AddFuture(Futures.Metals.Gold, Resolution.Minute);
var symbol = QuantConnect.Symbol.CreateCanonicalOption(future.Mapped);
var history = qb.History<OptionUniverse>(symbol, new DateTime(2020, 6, 1), new DateTime(2020, 6, 6));
foreach (var chain in history)
{
    var endTime = chain.EndTime;
    var filteredContracts = chain.Data
        .Select(contract => contract as OptionUniverse)
        .Where(contract => contract.Greeks.Delta > 0.3m);
    foreach (var contract in filteredContracts)
    {
        var price = contract.Price;
        var iv = contract.ImpliedVolatility;
    }
}

For more information about historical Future Options Universe data in the Research Environment, see Universes.

Supported Assets

The following list shows the available (16) Futures Options:

  • Futures.Dairy.ClassIIIMilkFutures.Dairy.CLASS_III_MILK: Class III Milk Futures (CME: DC)
  • Futures.Energy.CrudeOilWTIFutures.Energy.CRUDE_OIL_WTI: Crude Oil WTI Futures (NYMEX: LO | Underlying: CL)
  • Futures.Energy.GasolineFutures.Energy.GASOLINE: Gasoline RBOB Futures (NYMEX: OB | Underlying: RB)
  • Futures.Energy.HeatingOilFutures.Energy.HEATING_OIL: Heating Oil Futures (NYMEX: OH | Underlying: HO)
  • Futures.Energy.NaturalGasFutures.Energy.NATURAL_GAS: Natural Gas Futures (NYMEX: ON | Underlying: NG)
  • Futures.Financials.Y10TreasuryNoteFutures.Financials.Y_10_TREASURY_NOTE: 10Y U.S. Treasury Note Futures (CBOT: OZN | Underlying: ZN)
  • Futures.Financials.Y2TreasuryNoteFutures.Financials.Y_2_TREASURY_NOTE: 2Y U.S. Treasury Note Futures (CBOT: OZT | Underlying: ZT)
  • Futures.Financials.Y30TreasuryBondFutures.Financials.Y_30_TREASURY_BOND: 30Y U.S. Treasury Bond Futures (CBOT: OZB | Underlying: ZB)
  • Futures.Grains.CornFutures.Grains.CORN: Corn Futures (CBOT: OZC | Underlying: ZC)
  • Futures.Grains.SoybeansFutures.Grains.SOYBEANS: Soybeans Futures (CBOT: OZS | Underlying: ZS)
  • Futures.Grains.WheatFutures.Grains.WHEAT: Default wheat contract is SRWWheat (CBOT: OZW | Underlying: ZW)
  • Futures.Indices.NASDAQ100EMiniFutures.Indices.NASDAQ_100_E_MINI: E-mini NASDAQ 100 Futures (CME: NQ)
  • Futures.Indices.SP500EMiniFutures.Indices.SP_500_E_MINI: E-mini S&P 500 Futures (CME: ES)
  • Futures.Metals.CopperFutures.Metals.COPPER: Copper Futures (COMEX: HXE | Underlying: HG)
  • Futures.Metals.GoldFutures.Metals.GOLD: Gold Futures (COMEX: OG | Underlying: GC)
  • Futures.Metals.SilverFutures.Metals.SILVER: Silver Futures (COMEX: SO | Underlying: SI)

Example Applications

The US Future Options dataset enables you to accurately design Future Option strategies. Examples include the following strategies:

  • Selling out of the money Future Option contracts to collect the premium that the Option buyer pays
  • Buying put Options to hedge against downward price movement in Future contracts you bought
  • Exploiting arbitrage opportunities that arise when the price of Option contracts deviate from their theoretical value

Classic Algorithm Example

The following example demonstrates a bull call spread Option strategy using universe filtering.

class FutureOptionAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2020,1,1)
        # Filter the underlying continuous Futures to narrow the FOP spectrum.
        self.underlying = self.add_future(Futures.Indices.SP_500_E_MINI,
            extended_market_hours=True,
            data_mapping_mode=DataMappingMode.OPEN_INTEREST,
            data_normalization_mode=DataNormalizationMode.BACKWARDS_RATIO,
            contract_depth_offset=0)
        self.underlying.set_filter(0, 182)
        # Use CallSpread filter to obtain the 2 best-matched contracts that forms a call spread.
        # It simplifies from further filtering and reduce computation on redundant subscription.
        self.add_future_option(self.underlying.symbol, lambda u: u.call_spread(5, 5, -5))
    
    def on_data(self, slice: Slice) -> None:
        if self.portfolio.invested:
            return
        # Create canonical symbol for the mapped future contract, since we need that to access the option chain.
        symbol = Symbol.create_canonical_option(self.underlying.mapped)
    
        # Get option chain data for the mapped future only.
        # It requires 2 contracts with different strikes to form a call spread, so we make sure at least 2 contracts are present.
        chain = slice.option_chains.get(symbol)
        if not chain or len(list(chain)) < 2:
            return
            
        # Separate the contracts by strike, as we need to access their strike.
        expiry = min([x.expiry for x in chain])
        sorted_by_strike = sorted([x.strike for x in chain])
        itm_strike = sorted_by_strike[0]
        otm_strike = sorted_by_strike[-1]
        
        # Use abstraction method to order a bull call spread to avoid manual error.
        option_strategy = OptionStrategies.bull_call_spread(symbol, itm_strike, otm_strike, expiry)
        self.buy(option_strategy, 1)
public class FutureOptionAlgorithm : QCAlgorithm
{
    private Future _underlying;

    public override void Initialize()
    {
        SetStartDate(2020,1,1);
        // Filter the underlying continuous Futures to narrow the FOP spectrum.
        _underlying = AddFuture(Futures.Indices.SP500EMini,
            extendedMarketHours: True,
            dataMappingMode: DataMappingMode.OpenInterest,
            dataNormalizationMode: DataNormalizationMode.BackwardsRatio,
            contractDepthOffset: 0);
        _underlying.SetFilter(0, 182);
        // Use CallSpread filter to obtain the 2 best-matched contracts that forms a call spread.
        // It simplifies from further filtering and reduce computation on redundant subscription.
        AddFutureOption(_underlying.Symbol, (u) => u.CallSpread(5, 5, -5));
    }
    
    public override void OnData(Slice slice)
    {
        if (Portfolio.Invested)
            return;

        // Create canonical symbol for the mapped future contract, since we need that to access the option chain.
        var symbol = QuantConnect.Symbol.CreateCanonicalOption(_underlying.Mapped);
    
        // Get option chain data for the mapped future only.
        // It requires 2 contracts with different strikes to form a call spread, so we make sure at least 2 contracts are present.
        if (!slice.OptionChains.TryGetValue(symbol, out var chain) || chain.Count() < 2)
            return;
    
        // Separate the contracts by strike, as we need to access their strike.
        var expiry = chain.Min(x => x.Expiry);
        var itmStrike = chain.Min(x => x.Strike);
        var otmStrike = chain.Max(x => x.Strike);
    
        // Use abstraction method to order a bull call spread to avoid manual error.
        var optionStrategy = OptionStrategies.BullCallSpread(symbol, itmStrike, otmStrike, expiry);
        Buy(optionStrategy, 1);
    }
}

Data Point Attributes

The US Future Options Universe dataset provides OptionFilterUniverse and OptionUniverse objects.

OptionFilterUniverse Attributes

OptionFilterUniverse objects have the following attributes:

OptionUniverse Attributes

OptionUniverse objects have the following attributes:

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: