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
count
count: int
Gets the number of elements contained in the dictionary
get_keys
get_keys: Iterable[Symbol]
Gets a collection containing the keys in the dictionary
This Property is protected.
get_values
get_values: Iterable[
QuantConnect_Data_Market_DataDictionary_T
]
Gets a collection containing the values in the dictionary
This Property is protected.
is_read_only
is_read_only: bool
Gets a value indicating whether the dictionary is read-only
dictionary
dictionary: (
QuantConnect_Util_BaseExtendedDictionary_TDictionary
)
The dictionary instance
This Property is protected.
time
time: datetime
Gets or sets the time associated with this collection of data
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.
fromkeys
fromkeys(
sequence: List[QuantConnect_ExtendedDictionary_TKey],
) -> Dict[
QuantConnect_ExtendedDictionary_TKey,
QuantConnect_ExtendedDictionary_TValue,
]
fromkeys(
sequence: List[QuantConnect_ExtendedDictionary_TKey],
value: QuantConnect_ExtendedDictionary_TValue,
) -> Dict[
QuantConnect_ExtendedDictionary_TKey,
QuantConnect_ExtendedDictionary_TValue,
]
Signature descriptions:
-
Creates a new dictionary from the given sequence of elements.
-
Creates a new dictionary from the given sequence of elements with a value provided by the user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sequence
|
List[QuantConnect_ExtendedDictionary_TKey]
|
Sequence of elements which is to be used as keys for the new dictionary |
required |
value
|
Optional[QuantConnect_ExtendedDictionary_TValue]
|
Value which is set to each element of the dictionary |
None
|
Returns:
| Type | Description |
|---|---|
Dict[QuantConnect_ExtendedDictionary_TKey, QuantConnect_ExtendedDictionary_TValue]
|
Returns a new dictionary with the given sequence of elements as the keys of the dictionary. |
get
get(
key: QuantConnect_ExtendedDictionary_TKey,
) -> QuantConnect_ExtendedDictionary_TValue
get(
key: QuantConnect_ExtendedDictionary_TKey,
default_value: QuantConnect_ExtendedDictionary_TValue,
) -> QuantConnect_ExtendedDictionary_TValue
Returns the value for the specified key if key is in dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_ExtendedDictionary_TKey
|
key to be searched in the dictionary |
required |
default_value
|
Optional[QuantConnect_ExtendedDictionary_TValue]
|
Value to be returned if the key is not found or if the key is None. |
None
|
Returns:
| Type | Description |
|---|---|
QuantConnect_ExtendedDictionary_TValue
|
The value for the specified key if key is in dictionary. |
pop
pop(
key: QuantConnect_ExtendedDictionary_TKey,
) -> QuantConnect_ExtendedDictionary_TValue
pop(
key: QuantConnect_ExtendedDictionary_TKey,
default_value: QuantConnect_ExtendedDictionary_TValue,
) -> QuantConnect_ExtendedDictionary_TValue
Removes and returns an element from a dictionary having the given key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_ExtendedDictionary_TKey
|
Key which is to be searched for removal |
required |
default_value
|
Optional[QuantConnect_ExtendedDictionary_TValue]
|
Value which is to be returned when the key is not in the dictionary |
None
|
Returns:
| Type | Description |
|---|---|
QuantConnect_ExtendedDictionary_TValue
|
If key is found - removed/popped element from the dictionary |
setdefault
setdefault(
key: QuantConnect_ExtendedDictionary_TKey,
) -> QuantConnect_ExtendedDictionary_TValue
setdefault(
key: QuantConnect_ExtendedDictionary_TKey,
default_value: QuantConnect_ExtendedDictionary_TValue,
) -> QuantConnect_ExtendedDictionary_TValue
Returns the value of a key (if the key is in dictionary). If not, it inserts key with a value to the dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_ExtendedDictionary_TKey
|
Key with null/None value is inserted to the dictionary if key is not in the dictionary. |
required |
default_value
|
Optional[QuantConnect_ExtendedDictionary_TValue]
|
Default value |
None
|
Returns:
| Type | Description |
|---|---|
QuantConnect_ExtendedDictionary_TValue
|
The value of the key if it is in the dictionary |
clear
clear() -> None
Removes all items from the dictionary
copy
copy() -> Dict[
QuantConnect_ExtendedDictionary_TKey,
QuantConnect_ExtendedDictionary_TValue,
]
Creates a shallow copy of the IExtendedDictionary{TKey, TValue}.
Returns:
| Type | Description |
|---|---|
Dict[QuantConnect_ExtendedDictionary_TKey, QuantConnect_ExtendedDictionary_TValue]
|
Returns a shallow copy of the dictionary. It doesn't modify the original dictionary. |
items
items() -> List[
Tuple[
QuantConnect_ExtendedDictionary_TKey,
QuantConnect_ExtendedDictionary_TValue,
]
]
Returns a view object that displays a list of dictionary's (key, value) tuple pairs.
Returns:
| Type | Description |
|---|---|
List[Tuple[QuantConnect_ExtendedDictionary_TKey, QuantConnect_ExtendedDictionary_TValue]]
|
Returns a view object that displays a list of a given dictionary's (key, value) tuple pair. |
keys
keys() -> List[QuantConnect_ExtendedDictionary_TKey]
Returns a view object that displays a list of all the key objects in the dictionary
Returns:
| Type | Description |
|---|---|
List[QuantConnect_ExtendedDictionary_TKey]
|
Returns a view object that displays a list of all the key objects. When the dictionary is changed, the view object also reflect these changes. |
popitem
popitem() -> Tuple[
QuantConnect_ExtendedDictionary_TKey,
QuantConnect_ExtendedDictionary_TValue,
]
Returns and removes an arbitrary element (key, value) pair from the dictionary.
Returns:
| Type | Description |
|---|---|
Tuple[QuantConnect_ExtendedDictionary_TKey, QuantConnect_ExtendedDictionary_TValue]
|
Returns an arbitrary element (key, value) pair from the dictionary removes an arbitrary element(the same element which is returned) from the dictionary. Note: Arbitrary elements and random elements are not same.The popitem() doesn't return a random element. |
update
update(other: Any) -> None
Updates the dictionary with the elements from the another dictionary object or from an iterable of key/value pairs. The update() method adds element(s) to the dictionary if the key is not in the dictionary.If the key is in the dictionary, it updates the key with the new value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Any
|
Takes either a dictionary or an iterable object of key/value pairs (generally tuples). |
required |
values
values() -> List[QuantConnect_ExtendedDictionary_TValue]
Returns a view object that displays a list of all the values in the dictionary.
Returns:
| Type | Description |
|---|---|
List[QuantConnect_ExtendedDictionary_TValue]
|
Returns a view object that displays a list of all values in a given dictionary. |
__contains__
__contains__(
key: Union[Symbol, str, BaseContract, Security],
) -> bool
Determines whether the dictionary contains the specified key
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Union[Symbol, str, BaseContract, Security]
|
The key to locate in the dictionary |
required |
Returns:
| Type | Description |
|---|---|
bool
|
true if the dictionary contains an element with the specified key; otherwise, false. |
__len__
__len__() -> int
check_for_implicitly_created_symbol
check_for_implicitly_created_symbol(
symbol: Union[Symbol, str, BaseContract, Security],
) -> None
Checks if the symbol is implicitly created from a string, in which case it is not in the symbol cache, and throws a KeyNotFoundException.
This Class is protected.
get_items
get_items() -> Sequence[
KeyValuePair[
Symbol,
QuantConnect_Data_Market_DataDictionary_T,
]
]
Gets all the items in the dictionary
Returns:
| Type | Description |
|---|---|
Sequence[KeyValuePair[Symbol, QuantConnect_Data_Market_DataDictionary_T]]
|
All the items in the dictionary. |
__iter__
__iter__() -> Iterator[
KeyValuePair[
Symbol,
QuantConnect_Data_Market_DataDictionary_T,
]
]
copy_to
copy_to(
array: List[
KeyValuePair[
QuantConnect_Util_BaseExtendedDictionary_TKey,
QuantConnect_Util_BaseExtendedDictionary_TValue,
]
],
array_index: int,
) -> None
Copies the elements of the dictionary to an array, starting at a particular array index
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[KeyValuePair[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue]]
|
The array to copy to |
required |
array_index
|
int
|
The starting index in the array |
required |
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_value
get_value(
key: Union[Symbol, str, BaseContract, Security],
) -> QuantConnect_Data_Market_DataDictionary_T
Gets the value associated with the specified key.