Lean
$LEAN_TAG$
|
Enumerable security management class for grouping security objects into an array and providing any common properties. More...
Public Member Functions | |
SecurityManager (ITimeKeeper timeKeeper) | |
Initialise the algorithm security manager with two empty dictionaries More... | |
void | Add (Symbol symbol, Security security) |
Add a new security with this symbol to the collection. More... | |
void | Add (Security security) |
Add a new security with this symbol to the collection. More... | |
void | Add (KeyValuePair< Symbol, Security > pair) |
Add a symbol-security by its key value pair. More... | |
override void | Clear () |
Clear the securities array to delete all the portfolio and asset information. More... | |
bool | Contains (KeyValuePair< Symbol, Security > pair) |
Check if this collection contains this key value pair. More... | |
bool | ContainsKey (Symbol symbol) |
Check if this collection contains this symbol. More... | |
void | CopyTo (KeyValuePair< Symbol, Security >[] array, int number) |
Copy from the internal array to an external array. More... | |
bool | Remove (KeyValuePair< Symbol, Security > pair) |
Remove a key value of of symbol-securities from the collections. More... | |
override bool | Remove (Symbol symbol) |
Remove this symbol security: Dictionary interface implementation. More... | |
override bool | TryGetValue (Symbol symbol, out Security security) |
Try and get this security object with matching symbol and return true on success. More... | |
void | SetSecurityService (SecurityService securityService) |
Sets the Security Service to be used More... | |
Security | CreateSecurity (Symbol symbol, List< SubscriptionDataConfig > subscriptionDataConfigList, decimal leverage=0, bool addToSymbolCache=true, Security underlying=null) |
Creates a new security More... | |
Security | CreateSecurity (Symbol symbol, SubscriptionDataConfig subscriptionDataConfig, decimal leverage=0, bool addToSymbolCache=true, Security underlying=null) |
Creates a new security More... | |
void | SetLiveMode (bool isLiveMode) |
Set live mode state of the algorithm More... | |
![]() | |
abstract bool | TryGetValue (Symbol symbol, out T value) |
Gets the value associated 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... | |
T | get (Symbol symbol) |
Returns the value for the specified Symbol if Symbol is in dictionary. More... | |
T | 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... | |
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. More... | |
T | 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... | |
T | pop (Symbol symbol) |
Removes and returns an element from a dictionary having the given Symbol. More... | |
T | 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... | |
Protected Member Functions | |
virtual void | OnCollectionChanged (NotifyCollectionChangedEventArgs changedEventArgs) |
Event invocator for the CollectionChanged event More... | |
Protected Attributes | |
override IEnumerable< Symbol > | GetKeys => Keys |
Gets an T:System.Collections.Generic.ICollection`1 containing the Symbol objects of the T:System.Collections.Generic.IDictionary`2. More... | |
override IEnumerable< Security > | GetValues => Values |
Gets an T:System.Collections.Generic.ICollection`1 containing the values in the T:System.Collections.Generic.IDictionary`2. More... | |
Properties | |
DateTime | UtcTime [get] |
Gets the most recent time this manager was updated More... | |
int | Count [get] |
Count of the number of securities in the collection. More... | |
override bool | IsReadOnly [get] |
Flag indicating if the internal array is read only. More... | |
ICollection< Symbol > | Keys [get] |
List of the symbol-keys in the collection of securities. More... | |
ICollection< Security > | Values [get] |
Get a list of the security objects for this collection. More... | |
override Security | this[Symbol symbol] [get, set] |
Indexer method for the security manager to access the securities objects by their symbol. More... | |
![]() | |
abstract IEnumerable< Symbol > | GetKeys [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... | |
Events | |
NotifyCollectionChangedEventHandler | CollectionChanged |
Event fired when a security is added or removed from this collection More... | |
Additional Inherited Members | |
![]() | |
virtual bool | IsReadOnly |
Gets a value indicating whether the IDictionary object is read-only. More... | |
Enumerable security management class for grouping security objects into an array and providing any common properties.
Implements IDictionary for the index searching of securities by symbol
Definition at line 30 of file SecurityManager.cs.
QuantConnect.Securities.SecurityManager.SecurityManager | ( | ITimeKeeper | timeKeeper | ) |
Initialise the algorithm security manager with two empty dictionaries
timeKeeper |
Definition at line 59 of file SecurityManager.cs.
Add a new security with this symbol to the collection.
IDictionary implementation
symbol | symbol for security we're trading |
security | security object |
Definition at line 72 of file SecurityManager.cs.
void QuantConnect.Securities.SecurityManager.Add | ( | Security | security | ) |
Add a new security with this symbol to the collection.
security | security object |
Definition at line 91 of file SecurityManager.cs.
Add a symbol-security by its key value pair.
IDictionary implementation
pair |
Definition at line 101 of file SecurityManager.cs.
|
virtual |
Clear the securities array to delete all the portfolio and asset information.
IDictionary implementation
Reimplemented from QuantConnect.ExtendedDictionary< Security >.
Definition at line 110 of file SecurityManager.cs.
Check if this collection contains this key value pair.
pair | Search key-value pair |
IDictionary implementation
Definition at line 127 of file SecurityManager.cs.
bool QuantConnect.Securities.SecurityManager.ContainsKey | ( | Symbol | symbol | ) |
Check if this collection contains this symbol.
symbol | Symbol we're checking for. |
IDictionary implementation
Definition at line 141 of file SecurityManager.cs.
void QuantConnect.Securities.SecurityManager.CopyTo | ( | KeyValuePair< Symbol, Security >[] | array, |
int | number | ||
) |
Copy from the internal array to an external array.
array | Array we're outputting to |
number | Starting index of array |
IDictionary implementation
Definition at line 155 of file SecurityManager.cs.
Remove a key value of of symbol-securities from the collections.
IDictionary implementation
pair | Key Value pair of symbol-security to remove |
Definition at line 193 of file SecurityManager.cs.
|
virtual |
Remove this symbol security: Dictionary interface implementation.
symbol | Symbol we're searching for |
Reimplemented from QuantConnect.ExtendedDictionary< Security >.
Definition at line 203 of file SecurityManager.cs.
override bool QuantConnect.Securities.SecurityManager.TryGetValue | ( | Symbol | symbol, |
out Security | security | ||
) |
Try and get this security object with matching symbol and return true on success.
symbol | String search symbol |
security | Output Security object |
IDictionary implementation
Definition at line 246 of file SecurityManager.cs.
|
protectedvirtual |
Event invocator for the CollectionChanged event
changedEventArgs | Event arguments for the CollectionChanged event |
Definition at line 366 of file SecurityManager.cs.
void QuantConnect.Securities.SecurityManager.SetSecurityService | ( | SecurityService | securityService | ) |
Sets the Security Service to be used
Definition at line 377 of file SecurityManager.cs.
Security QuantConnect.Securities.SecurityManager.CreateSecurity | ( | Symbol | symbol, |
List< SubscriptionDataConfig > | subscriptionDataConfigList, | ||
decimal | leverage = 0 , |
||
bool | addToSymbolCache = true , |
||
Security | underlying = null |
||
) |
Creates a new security
Following the obsoletion of Security.Subscriptions, both overloads will be merged removing SubscriptionDataConfig arguments
Definition at line 387 of file SecurityManager.cs.
Security QuantConnect.Securities.SecurityManager.CreateSecurity | ( | Symbol | symbol, |
SubscriptionDataConfig | subscriptionDataConfig, | ||
decimal | leverage = 0 , |
||
bool | addToSymbolCache = true , |
||
Security | underlying = null |
||
) |
Creates a new security
Following the obsoletion of Security.Subscriptions, both overloads will be merged removing SubscriptionDataConfig arguments
Definition at line 403 of file SecurityManager.cs.
void QuantConnect.Securities.SecurityManager.SetLiveMode | ( | bool | isLiveMode | ) |
Set live mode state of the algorithm
isLiveMode | True, live mode is enabled |
Definition at line 418 of file SecurityManager.cs.
Gets an T:System.Collections.Generic.ICollection`1 containing the Symbol objects of the T:System.Collections.Generic.IDictionary`2.
Definition at line 260 of file SecurityManager.cs.
|
protected |
Gets an T:System.Collections.Generic.ICollection`1 containing the values in the T:System.Collections.Generic.IDictionary`2.
Definition at line 268 of file SecurityManager.cs.
|
get |
Gets the most recent time this manager was updated
Definition at line 51 of file SecurityManager.cs.
|
get |
Count of the number of securities in the collection.
IDictionary implementation
Definition at line 168 of file SecurityManager.cs.
|
get |
Flag indicating if the internal array is read only.
IDictionary implementation
Definition at line 183 of file SecurityManager.cs.
|
get |
List of the symbol-keys in the collection of securities.
IDictionary implementation
Definition at line 224 of file SecurityManager.cs.
|
get |
Get a list of the security objects for this collection.
IDictionary implementation
Definition at line 275 of file SecurityManager.cs.
Indexer method for the security manager to access the securities objects by their symbol.
IDictionary implementation
symbol | Symbol object indexer |
Definition at line 330 of file SecurityManager.cs.
NotifyCollectionChangedEventHandler QuantConnect.Securities.SecurityManager.CollectionChanged |
Event fired when a security is added or removed from this collection
Definition at line 35 of file SecurityManager.cs.