Skip to content

CachingOptionChainProvider

QuantConnect.Lean.Engine.DataFeeds.CachingOptionChainProvider

CachingOptionChainProvider(
    option_chain_provider: IOptionChainProvider,
)

Bases: Object, IOptionChainProvider

An implementation of IOptionChainProvider that will cache by date option contracts returned by another option chain provider.

Initializes a new instance of the CachingOptionChainProvider class

Parameters:

Name Type Description Default
option_chain_provider IOptionChainProvider
required

get_option_contract_list

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

Gets the list of option contracts for a given 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 for which to request the option chain (only used in backtesting)

required

Returns:

Type Description
Iterable[Symbol]

The list of option contracts.