Skip to content

LiveOptionChainProvider

QuantConnect.Lean.Engine.DataFeeds.LiveOptionChainProvider

LiveOptionChainProvider()

Bases: BacktestingOptionChainProvider

An implementation of IOptionChainProvider that fetches the list of contracts from the Options Clearing Corporation (OCC) website

Initializes a new instance of the BacktestingChainProvider class

This codeEntityType is protected.

map_file_provider

map_file_provider: IMapFileProvider

The map file provider instance to use

This codeEntityType is protected.

history_provider

history_provider: IHistoryProvider

The history provider instance to use

This codeEntityType is protected.

get_option_contract_list

get_option_contract_list(
    symbol: Union[Symbol, str, BaseContract],
    date: Union[datetime, date],
) -> Iterable[Symbol]

Gets the option chain associated with the underlying Symbol

Parameters:

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

The option or the underlying symbol to get the option chain for. Providing the option allows targetting an option ticker different than the default e.g. SPXW

required
date Union[datetime, date]

The date to ask for the option contract list for

required

Returns:

Type Description
Iterable[Symbol]

Option chain.

get_symbols

get_symbols(
    canonical_symbol: Union[Symbol, str, BaseContract],
    date: Union[datetime, date],
) -> Iterable[Symbol]

Get the contract symbols associated with the given canonical symbol and date

This codeEntityType is protected.

Parameters:

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

The canonical symbol

required
date Union[datetime, date]

The date to search for

required

initialize

initialize(
    parameters: ChainProviderInitializeParameters,
) -> None

Initializes a new instance of the BacktestingChainProvider class

Parameters:

Name Type Description Default
parameters ChainProviderInitializeParameters

The initialization parameters

required

is_contract_expired

is_contract_expired(
    symbol: Union[Symbol, str, BaseContract],
    date: Union[datetime, date],
) -> bool

Helper method to determine if a contract is expired for the requested date

This codeEntityType is protected.