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:
Property | Value |
---|---|
Start Date | January 2012 |
Asset Coverage | 16 Monthly Future Contracts. Standard expires only. No weeklies or 0DTE contracts. |
Data Density | Dense |
Resolution | Daily |
Timezone | New York |
Market Hours | Regular and Extended |
Requesting Data
To add US Future Options Universe data to your algorithm, call the AddFutureOption
add_future_option
method. To define which contracts should be in your universe, specify the filter when requesting the Future Option data.
The AddFutureOption
add_future_option
method provides a daily stream of Option chain data. To get the most recent daily chain, call the OptionChain
option_chain
method with the underlying Future Symbol. The OptionChain
option_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:
: Class III Milk Futures (CME: DC)Futures.Dairy.ClassIIIMilk
Futures.Dairy.CLASS_III_MILK
: Crude Oil WTI Futures (NYMEX: LO | Underlying: CL)Futures.Energy.CrudeOilWTI
Futures.Energy.CRUDE_OIL_WTI
: Gasoline RBOB Futures (NYMEX: OB | Underlying: RB)Futures.Energy.Gasoline
Futures.Energy.GASOLINE
: Heating Oil Futures (NYMEX: OH | Underlying: HO)Futures.Energy.HeatingOil
Futures.Energy.HEATING_OIL
: Natural Gas Futures (NYMEX: ON | Underlying: NG)Futures.Energy.NaturalGas
Futures.Energy.NATURAL_GAS
: 10Y U.S. Treasury Note Futures (CBOT: OZN | Underlying: ZN)Futures.Financials.Y10TreasuryNote
Futures.Financials.Y_10_TREASURY_NOTE
: 2Y U.S. Treasury Note Futures (CBOT: OZT | Underlying: ZT)Futures.Financials.Y2TreasuryNote
Futures.Financials.Y_2_TREASURY_NOTE
: 30Y U.S. Treasury Bond Futures (CBOT: OZB | Underlying: ZB)Futures.Financials.Y30TreasuryBond
Futures.Financials.Y_30_TREASURY_BOND
: Corn Futures (CBOT: OZC | Underlying: ZC)Futures.Grains.Corn
Futures.Grains.CORN
: Soybeans Futures (CBOT: OZS | Underlying: ZS)Futures.Grains.Soybeans
Futures.Grains.SOYBEANS
: Default wheat contract is SRWWheat (CBOT: OZW | Underlying: ZW)Futures.Grains.Wheat
Futures.Grains.WHEAT
: E-mini NASDAQ 100 Futures (CME: NQ)Futures.Indices.NASDAQ100EMini
Futures.Indices.NASDAQ_100_E_MINI
: E-mini S&P 500 Futures (CME: ES)Futures.Indices.SP500EMini
Futures.Indices.SP_500_E_MINI
: Copper Futures (COMEX: HXE | Underlying: HG)Futures.Metals.Copper
Futures.Metals.COPPER
: Gold Futures (COMEX: OG | Underlying: GC)Futures.Metals.Gold
Futures.Metals.GOLD
: Silver Futures (COMEX: SO | Underlying: SI)Futures.Metals.Silver
Futures.Metals.SILVER
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); } }