Lean  $LEAN_TAG$
QuantConnect.Data.Market.DataDictionary< T > Class Template Reference

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

Inheritance diagram for QuantConnect.Data.Market.DataDictionary< T >:
[legend]

Public Member Functions

 DataDictionary ()
 Initializes a new instance of the QuantConnect.Data.Market.DataDictionary<T> class. More...
 
 DataDictionary (IEnumerable< T > data, Func< T, Symbol > keySelector)
 Initializes a new instance of the QuantConnect.Data.Market.DataDictionary<T> class using the specified data as a data source More...
 
 DataDictionary (DateTime time)
 Initializes a new instance of the QuantConnect.Data.Market.DataDictionary<T> class. More...
 
IEnumerator< KeyValuePair< Symbol, T > > GetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 
void Add (KeyValuePair< Symbol, T > item)
 Adds an item to the T:System.Collections.Generic.ICollection`1. More...
 
override void Clear ()
 Removes all items from the T:System.Collections.Generic.ICollection`1. More...
 
bool Contains (KeyValuePair< Symbol, T > item)
 Determines whether the T:System.Collections.Generic.ICollection`1 contains a specific value. More...
 
void CopyTo (KeyValuePair< Symbol, T >[] array, int arrayIndex)
 Copies the elements of the T:System.Collections.Generic.ICollection`1 to an T:System.Array, starting at a particular T:System.Array index. More...
 
bool Remove (KeyValuePair< Symbol, T > item)
 Removes the first occurrence of a specific object from the T:System.Collections.Generic.ICollection`1. More...
 
bool ContainsKey (Symbol key)
 Determines whether the System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the specified key. More...
 
void Add (Symbol key, T value)
 Adds an element with the provided key and value to the System.Collections.Generic.IDictionary<TKey, TValue>. More...
 
override bool Remove (Symbol key)
 Removes the element with the specified key from the System.Collections.Generic.IDictionary<TKey, TValue>. More...
 
override bool TryGetValue (Symbol key, out T value)
 Gets the value associated with the specified key. More...
 
virtual T GetValue (Symbol key)
 Gets the value associated with the specified key. More...
 
- Public Member Functions inherited from QuantConnect.ExtendedDictionary< 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 (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...
 

Protected Attributes

override IEnumerable< SymbolGetKeys => Keys
 Gets an T:System.Collections.Generic.ICollection`1 containing the Symbol objects of the T:System.Collections.Generic.IDictionary`2. More...
 
override IEnumerable< T > GetValues => Values
 Gets an T:System.Collections.Generic.ICollection`1 containing the values in the T:System.Collections.Generic.IDictionary`2. More...
 

Properties

DateTime Time [get, set]
 Gets or sets the time associated with this collection of data More...
 
int Count [get]
 Gets the number of elements contained in the T:System.Collections.Generic.ICollection`1. More...
 
override bool IsReadOnly [get]
 Gets a value indicating whether the T:System.Collections.Generic.ICollection`1 is read-only. More...
 
override T this[Symbol symbol] [get, set]
 Gets or sets the element with the specified key. More...
 
ICollection< SymbolKeys [get]
 Gets an T:System.Collections.Generic.ICollection`1 containing the keys of the T:System.Collections.Generic.IDictionary`2. More...
 
ICollection< T > Values [get]
 Gets an T:System.Collections.Generic.ICollection`1 containing the values in the T:System.Collections.Generic.IDictionary`2. More...
 
- Properties inherited from QuantConnect.ExtendedDictionary< T >
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...
 

Additional Inherited Members

- Public Attributes inherited from QuantConnect.ExtendedDictionary< T >
virtual bool IsReadOnly => true
 Gets a value indicating whether the IDictionary object is read-only. More...
 

Detailed Description

Provides a base class for types holding base data instances keyed by symbol

Definition at line 27 of file DataDictionary.cs.

Constructor & Destructor Documentation

◆ DataDictionary() [1/3]

Initializes a new instance of the QuantConnect.Data.Market.DataDictionary<T> class.

Definition at line 35 of file DataDictionary.cs.

◆ DataDictionary() [2/3]

QuantConnect.Data.Market.DataDictionary< T >.DataDictionary ( IEnumerable< T >  data,
Func< T, Symbol keySelector 
)

Initializes a new instance of the QuantConnect.Data.Market.DataDictionary<T> class using the specified data as a data source

Parameters
dataThe data source for this data dictionary
keySelectorDelegate used to select a key from the value

Definition at line 45 of file DataDictionary.cs.

◆ DataDictionary() [3/3]

Initializes a new instance of the QuantConnect.Data.Market.DataDictionary<T> class.

Parameters
timeThe time this data was emitted.

Definition at line 57 of file DataDictionary.cs.

Member Function Documentation

◆ GetEnumerator()

IEnumerator<KeyValuePair<Symbol, T> > QuantConnect.Data.Market.DataDictionary< T >.GetEnumerator ( )

Returns an enumerator that iterates through the collection.

Returns
A T:System.Collections.Generic.IEnumerator`1 that can be used to iterate through the collection.

<filterpriority>1</filterpriority>

Definition at line 76 of file DataDictionary.cs.

◆ Add() [1/2]

void QuantConnect.Data.Market.DataDictionary< T >.Add ( KeyValuePair< Symbol, T >  item)

Adds an item to the T:System.Collections.Generic.ICollection`1.

Parameters
itemThe object to add to the T:System.Collections.Generic.ICollection`1.
Exceptions
T:System.NotSupportedExceptionThe T:System.Collections.Generic.ICollection`1 is read-only.

Definition at line 96 of file DataDictionary.cs.

◆ Clear()

override void QuantConnect.Data.Market.DataDictionary< 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 from QuantConnect.ExtendedDictionary< T >.

Definition at line 105 of file DataDictionary.cs.

◆ Contains()

bool QuantConnect.Data.Market.DataDictionary< T >.Contains ( KeyValuePair< Symbol, T >  item)

Determines whether the T:System.Collections.Generic.ICollection`1 contains a specific value.

Returns
true if item is found in the T:System.Collections.Generic.ICollection`1; otherwise, false.
Parameters
itemThe object to locate in the T:System.Collections.Generic.ICollection`1.

Definition at line 117 of file DataDictionary.cs.

◆ CopyTo()

void QuantConnect.Data.Market.DataDictionary< T >.CopyTo ( KeyValuePair< Symbol, T >[]  array,
int  arrayIndex 
)

Copies the elements of the T:System.Collections.Generic.ICollection`1 to an T:System.Array, starting at a particular T:System.Array index.

Parameters
arrayThe one-dimensional T:System.Array that is the destination of the elements copied from T:System.Collections.Generic.ICollection`1. The T:System.Array must have zero-based indexing.
arrayIndexThe zero-based index in array at which copying begins.
Exceptions
T:System.ArgumentNullExceptionarray is null.
T:System.ArgumentOutOfRangeExceptionarrayIndex is less than 0.
T:System.ArgumentExceptionThe number of elements in the source T:System.Collections.Generic.ICollection`1 is greater than the available space from arrayIndex to the end of the destination array .

Definition at line 126 of file DataDictionary.cs.

◆ Remove() [1/2]

bool QuantConnect.Data.Market.DataDictionary< T >.Remove ( KeyValuePair< Symbol, T >  item)

Removes the first occurrence of a specific object from the T:System.Collections.Generic.ICollection`1.

Returns
true if item was successfully removed from the T:System.Collections.Generic.ICollection`1; otherwise, false. This method also returns false if item is not found in the original T:System.Collections.Generic.ICollection`1.
Parameters
itemThe object to remove from the T:System.Collections.Generic.ICollection`1.
Exceptions
T:System.NotSupportedExceptionThe T:System.Collections.Generic.ICollection`1 is read-only.

Definition at line 138 of file DataDictionary.cs.

◆ ContainsKey()

bool QuantConnect.Data.Market.DataDictionary< T >.ContainsKey ( Symbol  key)

Determines whether the System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the specified key.

Returns
true if the System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the key; otherwise, false.
Parameters
keyThe key to locate in the System.Collections.Generic.IDictionary<TKey, TValue>.
Exceptions
System.ArgumentNullExceptionkey is null.

Definition at line 172 of file DataDictionary.cs.

◆ Add() [2/2]

void QuantConnect.Data.Market.DataDictionary< T >.Add ( Symbol  key,
value 
)

Adds an element with the provided key and value to the System.Collections.Generic.IDictionary<TKey, TValue>.

Parameters
keyThe object to use as the key of the element to add.
valueThe object to use as the value of the element to add.
Exceptions
System.ArgumentNullExceptionkey is null.
T:System.ArgumentExceptionAn element with the same key already exists in the T:System.Collections.Generic.IDictionary`2.
T:System.NotSupportedExceptionThe T:System.Collections.Generic.IDictionary`2 is read-only.

Definition at line 181 of file DataDictionary.cs.

◆ Remove() [2/2]

override bool QuantConnect.Data.Market.DataDictionary< T >.Remove ( Symbol  key)
virtual

Removes the element with the specified key from the System.Collections.Generic.IDictionary<TKey, TValue>.

Returns
true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original System.Collections.Generic.IDictionary<TKey, TValue>.
Parameters
keyThe key of the element to remove.
Exceptions
System.ArgumentNullExceptionkey is null.
System.NotSupportedExceptionThe System.Collections.Generic.IDictionary<TKey, TValue> is read-only.

Reimplemented from QuantConnect.ExtendedDictionary< T >.

Definition at line 193 of file DataDictionary.cs.

◆ TryGetValue()

override bool QuantConnect.Data.Market.DataDictionary< T >.TryGetValue ( Symbol  key,
out T  value 
)
virtual

Gets the value associated with the specified key.

Returns
true if the object that implements System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the specified key; otherwise, false.
Parameters
keyThe key whose value to get.
valueWhen this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.
Exceptions
T:System.ArgumentNullExceptionkey is null.

Implements QuantConnect.ExtendedDictionary< T >.

Definition at line 205 of file DataDictionary.cs.

Here is the caller graph for this function:

◆ GetValue()

virtual T QuantConnect.Data.Market.DataDictionary< T >.GetValue ( Symbol  key)
virtual

Gets the value associated with the specified key.

Parameters
keyThe key whose value to get.
Returns
The value associated with the specified key, if the key is found; otherwise, the default value for the type of the T parameter.

Definition at line 282 of file DataDictionary.cs.

Member Data Documentation

◆ GetKeys

override IEnumerable<Symbol> QuantConnect.Data.Market.DataDictionary< T >.GetKeys => Keys
protected

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 265 of file DataDictionary.cs.

◆ GetValues

override IEnumerable<T> QuantConnect.Data.Market.DataDictionary< T >.GetValues => Values
protected

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 273 of file DataDictionary.cs.

Property Documentation

◆ Time

Gets or sets the time associated with this collection of data

Definition at line 67 of file DataDictionary.cs.

◆ Count

Gets the number of elements contained in the T:System.Collections.Generic.ICollection`1.

Returns
The number of elements contained in the T:System.Collections.Generic.ICollection`1.

Definition at line 150 of file DataDictionary.cs.

◆ IsReadOnly

override bool QuantConnect.Data.Market.DataDictionary< T >.IsReadOnly
get

Gets a value indicating whether the T:System.Collections.Generic.ICollection`1 is read-only.

Returns
true if the T:System.Collections.Generic.ICollection`1 is read-only; otherwise, false.

Definition at line 161 of file DataDictionary.cs.

◆ this[Symbol symbol]

override T QuantConnect.Data.Market.DataDictionary< T >.this[Symbol symbol]
getset

Gets or sets the element with the specified key.

Returns
The element with the specified key.
Parameters
symbolThe key of the element to get or set.
Exceptions
System.ArgumentNullExceptionsymbol is null.
System.Collections.Generic.KeyNotFoundExceptionThe property is retrieved and symbol is not found.
System.NotSupportedExceptionThe property is set and the System.Collections.Generic.IDictionary<TKey, TValue> is read-only.

Definition at line 221 of file DataDictionary.cs.

◆ Keys

ICollection<Symbol> QuantConnect.Data.Market.DataDictionary< T >.Keys
get

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

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

Definition at line 244 of file DataDictionary.cs.

◆ Values

ICollection<T> QuantConnect.Data.Market.DataDictionary< T >.Values
get

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 255 of file DataDictionary.cs.


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