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... | |
Security | CreateBenchmarkSecurity (Symbol symbol) |
Creates a new benchmark security More... | |
void | SetLiveMode (bool isLiveMode) |
Set live mode state of the algorithm More... | |
Public Member Functions inherited from QuantConnect.ExtendedDictionary< Security > | |
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 System.Collections.Generic.ICollection<T> containing the Symbol objects of the System.Collections.Generic.IDictionary<TKey, TValue>. More... | |
override IEnumerable< Security > | GetValues => Values |
Gets an System.Collections.Generic.ICollection<T> containing the values in the System.Collections.Generic.IDictionary<TKey, TValue>. 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... | |
ICollection< Security > | Total [get] |
Get a list of the complete security objects for this collection, including non active or delisted securities More... | |
override Security | this[Symbol symbol] [get, set] |
Indexer method for the security manager to access the securities objects by their symbol. More... | |
Properties inherited from QuantConnect.ExtendedDictionary< Security > | |
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 | |
Public Attributes inherited from QuantConnect.ExtendedDictionary< Security > | |
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 60 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 74 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 97 of file SecurityManager.cs.
Add a symbol-security by its key value pair.
IDictionary implementation
pair |
Definition at line 107 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 116 of file SecurityManager.cs.
Check if this collection contains this key value pair.
pair | Search key-value pair |
IDictionary implementation
Definition at line 134 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 148 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 162 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 200 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 210 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 253 of file SecurityManager.cs.
|
protectedvirtual |
Event invocator for the CollectionChanged event
changedEventArgs | Event arguments for the CollectionChanged event |
Definition at line 391 of file SecurityManager.cs.
void QuantConnect.Securities.SecurityManager.SetSecurityService | ( | SecurityService | securityService | ) |
Sets the Security Service to be used
Definition at line 402 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 412 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 428 of file SecurityManager.cs.
Creates a new benchmark security
Definition at line 442 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 451 of file SecurityManager.cs.
Gets an System.Collections.Generic.ICollection<T> containing the Symbol objects of the System.Collections.Generic.IDictionary<TKey, TValue>.
Excludes non active or delisted securities
Definition at line 268 of file SecurityManager.cs.
|
protected |
Gets an System.Collections.Generic.ICollection<T> containing the values in the System.Collections.Generic.IDictionary<TKey, TValue>.
Excludes non active or delisted securities
Definition at line 277 of file SecurityManager.cs.
|
get |
Gets the most recent time this manager was updated
Definition at line 52 of file SecurityManager.cs.
|
get |
Count of the number of securities in the collection.
IDictionary implementation
Definition at line 175 of file SecurityManager.cs.
|
get |
Flag indicating if the internal array is read only.
IDictionary implementation
Definition at line 190 of file SecurityManager.cs.
|
get |
List of the symbol-keys in the collection of securities.
Excludes non active or delisted securities
Definition at line 231 of file SecurityManager.cs.
|
get |
Get a list of the security objects for this collection.
Excludes non active or delisted securities
Definition at line 284 of file SecurityManager.cs.
|
get |
Get a list of the complete security objects for this collection, including non active or delisted securities
Definition at line 303 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 355 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.