BaseExtendedDictionary
QuantConnect.Util.BaseExtendedDictionary
BaseExtendedDictionary()
BaseExtendedDictionary(
dictionary: QuantConnect_Util_BaseExtendedDictionary_TDictionary,
)
BaseExtendedDictionary(
data: List[
QuantConnect_Util_BaseExtendedDictionary_TValue
],
key_selector: Callable[
[QuantConnect_Util_BaseExtendedDictionary_TValue],
QuantConnect_Util_BaseExtendedDictionary_TKey,
],
)
BaseExtendedDictionary(
dictionary: IDictionary[
QuantConnect_Util_BaseExtendedDictionary_TKey,
QuantConnect_Util_BaseExtendedDictionary_TValue,
],
)
BaseExtendedDictionary(
dictionary: Dictionary[
QuantConnect_Util_BaseExtendedDictionary_TKey,
QuantConnect_Util_BaseExtendedDictionary_TValue,
],
copy: bool,
)
Bases: Generic[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue, QuantConnect_Util_BaseExtendedDictionary_TDictionary], ExtendedDictionary[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue], IDictionary[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue], Iterable[KeyValuePair[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue]]
Provides a generic implementation of ExtendedDictionary with specific dictionary type
Signature descriptions:
-
Initializes a new instance of the BaseExtendedDictionary class that is empty
-
Initializes a new instance of the BaseExtendedDictionary class that contains elements copied from the specified dictionary
-
Initializes a new instance of the BaseExtendedDictionary class using the specified data as a data source
-
Initializes a new instance of the BaseExtendedDictionary class using the specified dictionary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dictionary
|
Optional[QuantConnect_Util_BaseExtendedDictionary_TDictionary | IDictionary[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue] | Dictionary[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue]]
|
The dictionary whose elements are copied to the new dictionary |
None
|
data
|
Optional[List[QuantConnect_Util_BaseExtendedDictionary_TValue]]
|
The data source for this dictionary |
None
|
key_selector
|
Optional[Callable[[QuantConnect_Util_BaseExtendedDictionary_TValue], QuantConnect_Util_BaseExtendedDictionary_TKey]]
|
Delegate used to select a key from the value |
None
|
copy
|
Optional[bool]
|
True to copy the elements into a new dictionary, false to wrap the given instance so that any changes made to it are reflected |
None
|
dictionary
dictionary: (
QuantConnect_Util_BaseExtendedDictionary_TDictionary
)
The dictionary instance
This Property is protected.
count
count: int
Gets the number of elements contained in the dictionary
is_read_only
is_read_only: bool
Gets a value indicating whether the dictionary is read-only
get_keys
get_keys: Iterable[
QuantConnect_Util_BaseExtendedDictionary_TKey
]
Gets a collection containing the keys in the dictionary
This Property is protected.
get_values
get_values: Iterable[
QuantConnect_Util_BaseExtendedDictionary_TValue
]
Gets a collection containing the values in the dictionary
This Property is protected.
add
add(
key: QuantConnect_Util_BaseExtendedDictionary_TKey,
value: QuantConnect_Util_BaseExtendedDictionary_TValue,
) -> None
add(
item: KeyValuePair[
QuantConnect_Util_BaseExtendedDictionary_TKey,
QuantConnect_Util_BaseExtendedDictionary_TValue,
],
) -> None
Signature descriptions:
-
Adds an element with the provided key and value to the dictionary
-
Adds an element with the provided key-value pair to the dictionary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Optional[QuantConnect_Util_BaseExtendedDictionary_TKey]
|
The key of the element to add |
None
|
value
|
Optional[QuantConnect_Util_BaseExtendedDictionary_TValue]
|
The value of the element to add |
None
|
item
|
Optional[KeyValuePair[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue]]
|
The key-value pair to add |
None
|
remove
remove(
key: QuantConnect_Util_BaseExtendedDictionary_TKey,
) -> bool
remove(
item: KeyValuePair[
QuantConnect_Util_BaseExtendedDictionary_TKey,
QuantConnect_Util_BaseExtendedDictionary_TValue,
],
) -> bool
Signature descriptions:
-
Removes the value with the specified key
-
Removes the first occurrence of a specific object from the dictionary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Optional[QuantConnect_Util_BaseExtendedDictionary_TKey]
|
The key of the element to remove |
None
|
item
|
Optional[KeyValuePair[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue]]
|
The key-value pair to remove |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
Depends on the signature used. Case 1: [true if the element was successfully found and removed; otherwise, false.]; Case 2: [true if the key-value pair was successfully removed; otherwise, false.] |
__contains__
__contains__(
key: QuantConnect_Util_BaseExtendedDictionary_TKey,
) -> bool
Determines whether the dictionary contains the specified key
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_Util_BaseExtendedDictionary_TKey
|
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. |
__getitem__
__getitem__(
key: QuantConnect_Util_BaseExtendedDictionary_TKey,
) -> QuantConnect_Util_BaseExtendedDictionary_TValue
Gets or sets the value associated with the specified key
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_Util_BaseExtendedDictionary_TKey
|
The key of the value to get or set |
required |
Returns:
| Type | Description |
|---|---|
QuantConnect_Util_BaseExtendedDictionary_TValue
|
The value associated with the specified key. |
__iter__
__iter__() -> Iterator[
KeyValuePair[
QuantConnect_Util_BaseExtendedDictionary_TKey,
QuantConnect_Util_BaseExtendedDictionary_TValue,
]
]
__len__
__len__() -> int
__setitem__
__setitem__(
key: QuantConnect_Util_BaseExtendedDictionary_TKey,
value: QuantConnect_Util_BaseExtendedDictionary_TValue,
) -> None
Gets or sets the value associated with the specified key
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_Util_BaseExtendedDictionary_TKey
|
The key of the value to get or set |
required |
Returns:
| Type | Description |
|---|---|
None
|
The value associated with the specified key. |
clear
clear() -> None
Removes all items from the dictionary
contains
contains(
item: KeyValuePair[
QuantConnect_Util_BaseExtendedDictionary_TKey,
QuantConnect_Util_BaseExtendedDictionary_TValue,
],
) -> bool
Determines whether the dictionary contains a specific key-value pair
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
KeyValuePair[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue]
|
The key-value pair to locate |
required |
Returns:
| Type | Description |
|---|---|
bool
|
true if the key-value pair was found; otherwise, false. |
contains_key
contains_key(
key: QuantConnect_Util_BaseExtendedDictionary_TKey,
) -> bool
Determines whether the dictionary contains the specified key
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_Util_BaseExtendedDictionary_TKey
|
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. |
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[
QuantConnect_Util_BaseExtendedDictionary_TKey,
QuantConnect_Util_BaseExtendedDictionary_TValue,
]
]
Returns an enumerator that iterates through the dictionary
Returns:
| Type | Description |
|---|---|
IEnumerator[KeyValuePair[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue]]
|
An enumerator for the dictionary. |
get_items
get_items() -> Sequence[
KeyValuePair[
QuantConnect_Util_BaseExtendedDictionary_TKey,
QuantConnect_Util_BaseExtendedDictionary_TValue,
]
]
Gets all the items in the dictionary
Returns:
| Type | Description |
|---|---|
Sequence[KeyValuePair[QuantConnect_Util_BaseExtendedDictionary_TKey, QuantConnect_Util_BaseExtendedDictionary_TValue]]
|
All the items in the dictionary. |
try_get_value
try_get_value(
key: QuantConnect_Util_BaseExtendedDictionary_TKey,
value: Optional[
QuantConnect_Util_BaseExtendedDictionary_TValue
],
) -> Tuple[
bool, QuantConnect_Util_BaseExtendedDictionary_TValue
]
Gets the value associated with the specified key
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_Util_BaseExtendedDictionary_TKey
|
The key whose value to get |
required |
value
|
Optional[QuantConnect_Util_BaseExtendedDictionary_TValue]
|
When this method returns, the value associated with the specified key |
required |
Returns:
| Type | Description |
|---|---|
Tuple[bool, QuantConnect_Util_BaseExtendedDictionary_TValue]
|
true if the key was found; otherwise, false. |
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 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 |
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. |
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.