Lean  $LEAN_TAG$
QuantConnect.ExtendedDictionary< T > Class Template Referenceabstract

Provides a base class for types holding instances keyed by Symbol More...

Inheritance diagram for QuantConnect.ExtendedDictionary< T >:
[legend]

Public Member Functions

virtual void Clear ()
 Removes all items from the T:System.Collections.Generic.ICollection`1. More...
 
abstract bool TryGetValue (Symbol symbol, out T value)
 Gets the value associated with the specified Symbol. More...
 
virtual bool Remove (Symbol symbol)
 Removes the value with the specified Symbol More...
 
void clear ()
 Removes all keys and values from the IExtendedDictionary<TKey, TValue>. More...
 
PyDict copy ()
 Creates a shallow copy of the IExtendedDictionary<TKey, TValue>. More...
 
PyDict fromkeys (Symbol[] sequence)
 Creates a new dictionary from the given sequence of elements. More...
 
PyDict fromkeys (Symbol[] sequence, T value)
 Creates a new dictionary from the given sequence of elements with a value provided by the user. More...
 
get (Symbol symbol)
 Returns the value for the specified Symbol if Symbol is in dictionary. More...
 
get (Symbol symbol, T value)
 Returns the value for the specified Symbol if Symbol is in dictionary. More...
 
PyList items ()
 Returns a view object that displays a list of dictionary's (Symbol, value) tuple pairs. More...
 
PyTuple popitem ()
 Returns and removes an arbitrary element (Symbol, value) pair from the dictionary. More...
 
setdefault (Symbol symbol)
 Returns the value of a Symbol (if the Symbol is in dictionary). If not, it inserts Symbol with a value to the dictionary. More...
 
setdefault (Symbol symbol, T default_value)
 Returns the value of a Symbol (if the Symbol is in dictionary). If not, it inserts Symbol with a value to the dictionary. More...
 
pop (Symbol symbol)
 Removes and returns an element from a dictionary having the given Symbol. More...
 
pop (Symbol symbol, T default_value)
 Removes and returns an element from a dictionary having the given Symbol. More...
 
void update (PyObject other)
 Updates the dictionary with the elements from the another dictionary object or from an iterable of Symbol/value pairs. The update() method adds element(s) to the dictionary if the Symbol is not in the dictionary.If the Symbol is in the dictionary, it updates the Symbol with the new value. More...
 
PyList keys ()
 Returns a view object that displays a list of all the Symbol objects in the dictionary More...
 
PyList values ()
 Returns a view object that displays a list of all the values in the dictionary. More...
 
- Public Member Functions inherited from QuantConnect.Interfaces.IExtendedDictionary< Symbol, T >
void clear ()
 Removes all keys and values from the IExtendedDictionary<TKey, TValue>. More...
 
PyDict copy ()
 Creates a shallow copy of the IExtendedDictionary<TKey, TValue>. More...
 
PyDict fromkeys (TKey[] sequence)
 Creates a new dictionary from the given sequence of elements. More...
 
PyDict fromkeys (TKey[] sequence, TValue value)
 Creates a new dictionary from the given sequence of elements with a value provided by the user. More...
 
TValue get (TKey key)
 Returns the value for the specified key if key is in dictionary. More...
 
TValue get (TKey key, TValue value)
 Returns the value for the specified key if key is in dictionary. More...
 
PyList items ()
 Returns a view object that displays a list of dictionary's (key, value) tuple pairs. More...
 
PyList keys ()
 Returns a view object that displays a list of all the keys in the dictionary More...
 
PyTuple popitem ()
 Returns and removes an arbitrary element (key, value) pair from the dictionary. More...
 
TValue setdefault (TKey key)
 Returns the value of a key (if the key is in dictionary). If not, it inserts key with a value to the dictionary. More...
 
TValue setdefault (TKey key, TValue default_value)
 Returns the value of a key (if the key is in dictionary). If not, it inserts key with a value to the dictionary. More...
 
TValue pop (TKey key)
 Removes and returns an element from a dictionary having the given key. More...
 
TValue pop (TKey key, TValue default_value)
 Removes and returns an element from a dictionary having the given key. More...
 
void update (PyObject other)
 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. More...
 
PyList values ()
 Returns a view object that displays a list of all the values in the dictionary. More...
 

Public Attributes

virtual bool IsReadOnly => true
 Gets a value indicating whether the IDictionary object is read-only. More...
 

Properties

abstract IEnumerable< SymbolGetKeys [get]
 Gets an T:System.Collections.Generic.ICollection`1 containing the Symbol objects of the T:System.Collections.Generic.IDictionary`2. More...
 
abstract IEnumerable< T > GetValues [get]
 Gets an T:System.Collections.Generic.ICollection`1 containing the values in the T:System.Collections.Generic.IDictionary`2. More...
 
virtual T this[Symbol symbol] [get, set]
 Indexer method for the base dictioanry to access the objects by their symbol. More...
 
virtual T this[string ticker] [get, set]
 Indexer method for the base dictioanry to access the objects by their symbol. More...
 

Detailed Description

Provides a base class for types holding instances keyed by Symbol

Definition at line 28 of file ExtendedDictionary.cs.

Member Function Documentation

◆ Clear()

virtual void QuantConnect.ExtendedDictionary< T >.Clear ( )
virtual

Removes all items from the T:System.Collections.Generic.ICollection`1.

Exceptions
T:System.NotSupportedExceptionThe T:System.Collections.Generic.ICollection`1 is read-only.

Reimplemented in QuantConnect.Securities.SecurityPortfolioManager, QuantConnect.Securities.SecurityManager, and QuantConnect.Data.Market.DataDictionary< T >.

Definition at line 34 of file ExtendedDictionary.cs.

Here is the caller graph for this function:

◆ TryGetValue()

abstract bool QuantConnect.ExtendedDictionary< T >.TryGetValue ( Symbol  symbol,
out T  value 
)
pure virtual

Gets the value associated with the specified Symbol.

Returns
true if the object that implements T:System.Collections.Generic.IDictionary`2 contains an element with the specified Symbol; otherwise, false.
Parameters
symbolThe Symbol whose value to get.
valueWhen this method returns, the value associated with the specified Symbol, if the Symbol is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.
Exceptions
T:System.ArgumentNullExceptionsymbol is null.

Implemented in QuantConnect.Data.Market.DataDictionary< T >.

Here is the caller graph for this function:

◆ Remove()

virtual bool QuantConnect.ExtendedDictionary< T >.Remove ( Symbol  symbol)
virtual

Removes the value with the specified Symbol

Parameters
symbolThe Symbol object of the element to remove.
Returns
true if the element is successfully found and removed; otherwise, false.

Reimplemented in QuantConnect.Securities.SecurityManager, QuantConnect.Securities.SecurityPortfolioManager, and QuantConnect.Data.Market.DataDictionary< T >.

Definition at line 79 of file ExtendedDictionary.cs.

Here is the caller graph for this function:

◆ clear()

void QuantConnect.ExtendedDictionary< T >.clear ( )

Removes all keys and values from the IExtendedDictionary<TKey, TValue>.

Definition at line 137 of file ExtendedDictionary.cs.

◆ copy()

PyDict QuantConnect.ExtendedDictionary< T >.copy ( )

Creates a shallow copy of the IExtendedDictionary<TKey, TValue>.

Returns
Returns a shallow copy of the dictionary. It doesn't modify the original dictionary.

Definition at line 146 of file ExtendedDictionary.cs.

◆ fromkeys() [1/2]

PyDict QuantConnect.ExtendedDictionary< T >.fromkeys ( Symbol[]  sequence)

Creates a new dictionary from the given sequence of elements.

Parameters
sequenceSequence of elements which is to be used as keys for the new dictionary
Returns
Returns a new dictionary with the given sequence of elements as the keys of the dictionary.

Definition at line 156 of file ExtendedDictionary.cs.

Here is the caller graph for this function:

◆ fromkeys() [2/2]

PyDict QuantConnect.ExtendedDictionary< T >.fromkeys ( Symbol[]  sequence,
value 
)

Creates a new dictionary from the given sequence of elements with a value provided by the user.

Parameters
sequenceSequence of elements which is to be used as keys for the new dictionary
valueValue which is set to each each element of the dictionary
Returns
Returns a new dictionary with the given sequence of elements as the keys of the dictionary. Each element of the newly created dictionary is set to the provided value.

Definition at line 168 of file ExtendedDictionary.cs.

◆ get() [1/2]

T QuantConnect.ExtendedDictionary< T >.get ( Symbol  symbol)

Returns the value for the specified Symbol if Symbol is in dictionary.

Parameters
symbolSymbol to be searched in the dictionary
Returns
The value for the specified Symbol if Symbol is in dictionary. None if the Symbol is not found and value is not specified.

Definition at line 188 of file ExtendedDictionary.cs.

◆ get() [2/2]

T QuantConnect.ExtendedDictionary< T >.get ( Symbol  symbol,
value 
)

Returns the value for the specified Symbol if Symbol is in dictionary.

Parameters
symbolSymbol to be searched in the dictionary
valueValue to be returned if the Symbol is not found. The default value is null.
Returns
The value for the specified Symbol if Symbol is in dictionary. value if the Symbol is not found and value is specified.

Definition at line 202 of file ExtendedDictionary.cs.

◆ items()

PyList QuantConnect.ExtendedDictionary< T >.items ( )

Returns a view object that displays a list of dictionary's (Symbol, value) tuple pairs.

Returns
Returns a view object that displays a list of a given dictionary's (Symbol, value) tuple pair.

Definition at line 216 of file ExtendedDictionary.cs.

◆ popitem()

PyTuple QuantConnect.ExtendedDictionary< T >.popitem ( )

Returns and removes an arbitrary element (Symbol, value) pair from the dictionary.

Returns
Returns an arbitrary element (Symbol, 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.

Definition at line 244 of file ExtendedDictionary.cs.

◆ setdefault() [1/2]

T QuantConnect.ExtendedDictionary< T >.setdefault ( Symbol  symbol)

Returns the value of a Symbol (if the Symbol is in dictionary). If not, it inserts Symbol with a value to the dictionary.

Parameters
symbolKey with null/None value is inserted to the dictionary if Symbol is not in the dictionary.
Returns
The value of the Symbol if it is in the dictionary None if Symbol is not in the dictionary

Definition at line 255 of file ExtendedDictionary.cs.

Here is the caller graph for this function:

◆ setdefault() [2/2]

T QuantConnect.ExtendedDictionary< T >.setdefault ( Symbol  symbol,
default_value 
)

Returns the value of a Symbol (if the Symbol is in dictionary). If not, it inserts Symbol with a value to the dictionary.

Parameters
symbolKey with a value default_value is inserted to the dictionary if Symbol is not in the dictionary.
default_valueDefault value
Returns
The value of the Symbol if it is in the dictionary default_value if Symbol is not in the dictionary and default_value is specified

Definition at line 267 of file ExtendedDictionary.cs.

◆ pop() [1/2]

T QuantConnect.ExtendedDictionary< T >.pop ( Symbol  symbol)

Removes and returns an element from a dictionary having the given Symbol.

Parameters
symbolKey which is to be searched for removal
Returns
If Symbol is found - removed/popped element from the dictionary If Symbol is not found - KeyError exception is raised

Definition at line 290 of file ExtendedDictionary.cs.

Here is the caller graph for this function:

◆ pop() [2/2]

T QuantConnect.ExtendedDictionary< T >.pop ( Symbol  symbol,
default_value 
)

Removes and returns an element from a dictionary having the given Symbol.

Parameters
symbolKey which is to be searched for removal
default_valueValue which is to be returned when the Symbol is not in the dictionary
Returns
If Symbol is found - removed/popped element from the dictionary If Symbol is not found - value specified as the second argument(default)

Definition at line 302 of file ExtendedDictionary.cs.

◆ update()

void QuantConnect.ExtendedDictionary< T >.update ( PyObject  other)

Updates the dictionary with the elements from the another dictionary object or from an iterable of Symbol/value pairs. The update() method adds element(s) to the dictionary if the Symbol is not in the dictionary.If the Symbol is in the dictionary, it updates the Symbol with the new value.

Parameters
otherTakes either a dictionary or an iterable object of Symbol/value pairs (generally tuples).

Definition at line 318 of file ExtendedDictionary.cs.

◆ keys()

PyList QuantConnect.ExtendedDictionary< T >.keys ( )

Returns a view object that displays a list of all the Symbol objects in the dictionary

Returns
Returns a view object that displays a list of all the Symbol objects. When the dictionary is changed, the view object also reflect these changes.

Definition at line 337 of file ExtendedDictionary.cs.

◆ values()

PyList QuantConnect.ExtendedDictionary< T >.values ( )

Returns a view object that displays a list of all the values in the dictionary.

Returns
Returns a view object that displays a list of all values in a given dictionary.

Definition at line 346 of file ExtendedDictionary.cs.

Member Data Documentation

◆ IsReadOnly

virtual bool QuantConnect.ExtendedDictionary< T >.IsReadOnly => true

Gets a value indicating whether the IDictionary object is read-only.

IDictionary implementation

Definition at line 72 of file ExtendedDictionary.cs.

Property Documentation

◆ GetKeys

abstract IEnumerable<Symbol> QuantConnect.ExtendedDictionary< T >.GetKeys
getprotected

Gets an T:System.Collections.Generic.ICollection`1 containing the Symbol objects of the T:System.Collections.Generic.IDictionary`2.

Returns
An T:System.Collections.Generic.ICollection`1 containing the Symbol objects of the object that implements T:System.Collections.Generic.IDictionary`2.

Definition at line 58 of file ExtendedDictionary.cs.

◆ GetValues

abstract IEnumerable<T> QuantConnect.ExtendedDictionary< T >.GetValues
getprotected

Gets an T:System.Collections.Generic.ICollection`1 containing the values in the T:System.Collections.Generic.IDictionary`2.

Returns
An T:System.Collections.Generic.ICollection`1 containing the values in the object that implements T:System.Collections.Generic.IDictionary`2.

Definition at line 66 of file ExtendedDictionary.cs.

◆ this[Symbol symbol]

virtual T QuantConnect.ExtendedDictionary< T >.this[Symbol symbol]
getset

Indexer method for the base dictioanry to access the objects by their symbol.

IDictionary implementation

Parameters
symbolSymbol object indexer
Returns
Object of T

Definition at line 95 of file ExtendedDictionary.cs.

◆ this[string ticker]

virtual T QuantConnect.ExtendedDictionary< T >.this[string ticker]
getset

Indexer method for the base dictioanry to access the objects by their symbol.

IDictionary implementation

Parameters
tickerstring ticker symbol indexer
Returns
Object of T

Definition at line 113 of file ExtendedDictionary.cs.


The documentation for this class was generated from the following file: