Skip to content

OptionChains

QuantConnect.Data.Market.OptionChains

OptionChains()
OptionChains(flatten: bool)
OptionChains(
    time: Union[datetime, date], flatten: bool = True
)

Bases: BaseChains[OptionChain, OptionContract, OptionContracts]

Collection of OptionChain keyed by canonical option symbol

Creates a new instance of the OptionChains dictionary

time

time: datetime

Gets or sets the time associated with this collection of data

get_keys

get_keys: Iterable[Symbol]

Gets a collection containing the keys in the dictionary

This codeEntityType is protected.

get_values

get_values: Iterable[
    QuantConnect_Data_Market_DataDictionary_T
]

Gets a collection containing the values in the dictionary

This codeEntityType is protected.

data_frame

data_frame: Any

The data frame representation of the option chains

remove

remove(
    key: Union[Symbol, str, BaseContract, Security],
) -> bool
remove(item: KeyValuePair[Symbol, OptionChain]) -> bool

Signature descriptions:

  • Removes the element with the specified key, converting to canonical if needed.

  • Removes the specific key-value pair, converting key to canonical if needed.

__getitem__

__getitem__(
    symbol: Union[Symbol, str, BaseContract, Security],
) -> OptionChain

Gets or sets the OptionChain for the symbol, converting to canonical if needed.

__setitem__

__setitem__(
    symbol: Union[Symbol, str, BaseContract, Security],
    value: OptionChain,
) -> None

Gets or sets the OptionChain for the symbol, converting to canonical if needed.

add

add(
    key: Union[Symbol, str, BaseContract, Security],
    value: OptionChain,
) -> None

Adds the specified symbol and chain to the dictionary, converting to canonical if needed.

contains

contains(item: KeyValuePair[Symbol, OptionChain]) -> bool

Determines if the dictionary contains the specific key-value pair, converting key to canonical if needed.

contains_key

contains_key(
    key: Union[Symbol, str, BaseContract, Security],
) -> bool

Checks if an OptionChain exists for the given symbol. Converts to the canonical option symbol first if needed.

try_get_value

try_get_value(
    key: Union[Symbol, str, BaseContract, Security],
    value: Optional[OptionChain],
) -> Tuple[bool, OptionChain]

Tries to get the OptionChain for the given symbol. Converts to the canonical option symbol if needed before attempting retrieval.

__iter__

__iter__() -> Iterator[
    KeyValuePair[
        Symbol,
        QuantConnect_Data_Market_DataDictionary_T,
    ]
]

clear

clear() -> None

Removes all items from the dictionary

get_enumerator

get_enumerator() -> IEnumerator[
    KeyValuePair[
        Symbol,
        QuantConnect_Data_Market_DataDictionary_T,
    ]
]

Returns an enumerator that iterates through the dictionary

Returns:

Type Description
IEnumerator[KeyValuePair[Symbol, QuantConnect_Data_Market_DataDictionary_T]]

An enumerator for the dictionary.

get_items

get_items() -> Iterable[
    KeyValuePair[
        Symbol,
        QuantConnect_Data_Market_DataDictionary_T,
    ]
]

Gets all the items in the dictionary

Returns:

Type Description
Iterable[KeyValuePair[Symbol, QuantConnect_Data_Market_DataDictionary_T]]

All the items in the dictionary.

get_value

get_value(
    key: Union[Symbol, str, BaseContract, Security],
) -> QuantConnect_Data_Market_DataDictionary_T

Gets the value associated with the specified key.