Futures Options

Universes

Introduction

This page explains how to request historical data for a universe of Future Option contracts.

Create Subscriptions

Follow these steps to subscribe to a Futures Options universe:

  1. Load the assembly files and data types in their own cell.
  2. #load "../Initialize.csx"
  3. Import the data types.
  4. #load "../QuantConnect.csx"
    #r "../Microsoft.Data.Analysis.dll"
    
    using QuantConnect;
    using QuantConnect.Data;
    using QuantConnect.Algorithm;
    using QuantConnect.Research;
    using QuantConnect.Indicators;
    using QuantConnect.Securities;
    using QuantConnect.Data.UniverseSelection;
    using Microsoft.Data.Analysis;
  5. Create a QuantBook.
  6. var qb = new QuantBook();
    qb = QuantBook()
  7. Add the underlying Future.
  8. var future = qb.AddFuture(Futures.Indices.SP500EMini);
    future = qb.add_future(Futures.Indices.SP_500_E_MINI)

    To view the available underlying Futures in the US Future Options dataset, see Supported Assets.

Price History

The contract filter determines which Future Option contracts are in your universe each trading day. The default filter selects the contracts with the following characteristics:

  • Standard type (weeklies and non-standard contracts are not available)
  • Within 1 strike price of the underlying asset price
  • Expire within 35 days

To get the prices and volumes for all of the Future Option contracts that pass your filter during a specific period of time, get the underlying Future contract and then call the OptionHistoryoption_history method with the Future contract's Symbol object, a start DateTimedatetime, and an end DateTimedatetime.

start_date = datetime(2024, 1, 1)

# Select an underlying Futures contract. For example, get the front-month contract.
futures_contract = sorted(
    qb.future_chain_provider.get_future_contract_list(future.symbol, start_date),
    key=lambda symbol: symbol.id.date
)[0]

# Get the Options data for the selected Futures contract.
option_history = qb.option_history(
    futures_contract, start_date, futures_contract.id.date, Resolution.HOUR, 
    fill_forward=False, extended_market_hours=False
)
var startDate = new DateTime(2024, 1, 1);

// Select an underlying Futures contract. For example, get the front-month contract.
var futuresContract = qb.FutureChainProvider.GetFutureContractList(future.Symbol, startDate)
    .OrderBy(symbol => symbol.ID.Date)
    .Last();

// Get the Options data for the selected Futures contract.
var optionHistory = qb.OptionHistory(
    futuresContract, startDate, futuresContract.ID.Date, Resolution.Hour, 
    fillForward: false, extendedMarketHours: false
);

To convert the OptionHistory object to a DataFrame that contains the trade and quote information of each contract and the underlying, use the data_frame property.

option_history.data_frame
DataFrame of Options data

To get the expiration dates of all the contracts in an OptionHistory object, call the GetExpiryDatesget_expiry_dates method.

option_history.get_expiry_dates()
list of expiry dates

To get the strike prices of all the contracts in an OptionHistory object, call the GetStrikesget_strikes method.

option_history.get_strikes()
List of strike prices

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: