Skip to content

FuturesOptionsUnderlyingMapper

QuantConnect.Securities.FutureOption.FuturesOptionsUnderlyingMapper

Bases: Object

Creates the underlying Symbol that corresponds to a futures options contract

get_future_contract_month_no_rules_applied

get_future_contract_month_no_rules_applied(
    canonical_future_symbol: Union[
        Symbol, str, BaseContract
    ],
    future_option_expiration_date: Union[datetime, date],
) -> datetime

Gets the theoretical (i.e. intermediate/naive) future contract month if we assumed a 1-1 mapping between FOPs contract months and Futures contract months, i.e. they share the same contract month.

Parameters:

Name Type Description Default
canonical_future_symbol Union[Symbol, str, BaseContract]

Canonical future Symbol

required
future_option_expiration_date Union[datetime, date]

Future Option Expiration Date

required

Returns:

Type Description
datetime

Contract month assuming that the Future Option and Future share the same contract month.

get_underlying_future_from_future_option

get_underlying_future_from_future_option(
    future_option_ticker: str,
    market: str,
    future_option_expiration: Union[datetime, date],
    date: Optional[datetime] = None,
) -> Symbol

Gets the FOP's underlying Future. The underlying Future's contract month might not match the contract month of the Future Option when providing CBOT or COMEX based FOPs contracts to this method.

Parameters:

Name Type Description Default
future_option_ticker str

Future option ticker

required
market str

Market of the Future Option

required
future_option_expiration Union[datetime, date]

Expiration date of the future option

required
date Optional[datetime]

Date to search the future chain provider with. Optional, but required for CBOT based contracts

None

Returns:

Type Description
Symbol

Symbol if there is an underlying for the FOP, null if there's no underlying found for the Future Option.