Lean  $LEAN_TAG$
QuantConnect.Securities.UniverseManager Class Reference

Manages the algorithm's collection of universes More...

Inheritance diagram for QuantConnect.Securities.UniverseManager:
[legend]

Public Member Functions

 UniverseManager ()
 Initializes a new instance of the UniverseManager class More...
 
IEnumerator< KeyValuePair< Symbol, Universe > > GetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 
void Add (KeyValuePair< Symbol, Universe > item)
 Adds an item to the T:System.Collections.Generic.ICollection`1. More...
 
void Clear ()
 Removes all items from the T:System.Collections.Generic.ICollection`1. More...
 
bool Contains (KeyValuePair< Symbol, Universe > item)
 Determines whether the T:System.Collections.Generic.ICollection`1 contains a specific value. More...
 
void CopyTo (KeyValuePair< Symbol, Universe >[] 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, Universe > 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 T:System.Collections.Generic.IDictionary`2 contains an element with the specified key. More...
 
void Add (Symbol key, Universe universe)
 Adds an element with the provided key and value to the T:System.Collections.Generic.IDictionary`2. More...
 
void ProcessChanges ()
 Will trigger collection changed event if required More...
 
bool Remove (Symbol key)
 Removes the element with the specified key from the T:System.Collections.Generic.IDictionary`2. More...
 
bool TryGetValue (Symbol key, out Universe value)
 Gets the value associated with the specified key. More...
 

Public Attributes

IReadOnlyDictionary< Symbol, SecurityActiveSecurities
 Read-only dictionary containing all active securities. An active security is a security that is currently selected by the universe or has holdings or open orders. More...
 
int Count => _universes.Skip(0).Count()
 Gets the number of elements contained in the T:System.Collections.Generic.ICollection`1. More...
 
ICollection< SymbolKeys => _universes.Select(x => x.Key).ToList()
 Gets an T:System.Collections.Generic.ICollection`1 containing the keys of the T:System.Collections.Generic.IDictionary`2. More...
 
ICollection< UniverseValues => _universes.Select(x => x.Value).ToList()
 Gets an T:System.Collections.Generic.ICollection`1 containing the values in the T:System.Collections.Generic.IDictionary`2. More...
 

Protected Member Functions

virtual void OnCollectionChanged (NotifyCollectionChangedEventArgs e)
 Event invocator for the CollectionChanged event More...
 

Properties

bool IsReadOnly [get]
 Gets a value indicating whether the T:System.Collections.Generic.ICollection`1 is read-only. More...
 
Universe this[Symbol symbol] [get, set]
 Gets or sets the element with the specified key. More...
 

Events

NotifyCollectionChangedEventHandler CollectionChanged
 Event fired when a universe is added or removed More...
 

Detailed Description

Manages the algorithm's collection of universes

Definition at line 30 of file UniverseManager.cs.

Constructor & Destructor Documentation

◆ UniverseManager()

QuantConnect.Securities.UniverseManager.UniverseManager ( )

Initializes a new instance of the UniverseManager class

Definition at line 51 of file UniverseManager.cs.

Member Function Documentation

◆ GetEnumerator()

IEnumerator<KeyValuePair<Symbol, Universe> > QuantConnect.Securities.UniverseManager.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 65 of file UniverseManager.cs.

◆ Add() [1/2]

void QuantConnect.Securities.UniverseManager.Add ( KeyValuePair< Symbol, Universe 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 86 of file UniverseManager.cs.

Here is the caller graph for this function:

◆ Clear()

void QuantConnect.Securities.UniverseManager.Clear ( )

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

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

Definition at line 95 of file UniverseManager.cs.

◆ Contains()

bool QuantConnect.Securities.UniverseManager.Contains ( KeyValuePair< Symbol, Universe 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 107 of file UniverseManager.cs.

Here is the call graph for this function:

◆ CopyTo()

void QuantConnect.Securities.UniverseManager.CopyTo ( KeyValuePair< Symbol, Universe >[]  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 116 of file UniverseManager.cs.

◆ Remove() [1/2]

bool QuantConnect.Securities.UniverseManager.Remove ( KeyValuePair< Symbol, Universe 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 128 of file UniverseManager.cs.

Here is the caller graph for this function:

◆ ContainsKey()

bool QuantConnect.Securities.UniverseManager.ContainsKey ( Symbol  key)

Determines whether the T:System.Collections.Generic.IDictionary`2 contains an element with the specified key.

Returns
true if the T:System.Collections.Generic.IDictionary`2 contains an element with the key; otherwise, false.
Parameters
keyThe key to locate in the T:System.Collections.Generic.IDictionary`2.
Exceptions
T:System.ArgumentNullExceptionkey is null.

Definition at line 159 of file UniverseManager.cs.

Here is the caller graph for this function:

◆ Add() [2/2]

void QuantConnect.Securities.UniverseManager.Add ( Symbol  key,
Universe  universe 
)

Adds an element with the provided key and value to the T:System.Collections.Generic.IDictionary`2.

Parameters
keyThe object to use as the key of the element to add.
universeThe object to use as the value of the element to add.
Exceptions
T: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 168 of file UniverseManager.cs.

◆ ProcessChanges()

void QuantConnect.Securities.UniverseManager.ProcessChanges ( )

Will trigger collection changed event if required

Definition at line 182 of file UniverseManager.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Remove() [2/2]

bool QuantConnect.Securities.UniverseManager.Remove ( Symbol  key)

Removes the element with the specified key from the T:System.Collections.Generic.IDictionary`2.

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

Definition at line 207 of file UniverseManager.cs.

Here is the call graph for this function:

◆ TryGetValue()

bool QuantConnect.Securities.UniverseManager.TryGetValue ( Symbol  key,
out Universe  value 
)

Gets the value associated with the specified key.

Returns
true if the object that implements T:System.Collections.Generic.IDictionary`2 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.

Definition at line 226 of file UniverseManager.cs.

Here is the caller graph for this function:

◆ OnCollectionChanged()

virtual void QuantConnect.Securities.UniverseManager.OnCollectionChanged ( NotifyCollectionChangedEventArgs  e)
protectedvirtual

Event invocator for the CollectionChanged event

Parameters
e

Definition at line 286 of file UniverseManager.cs.

Here is the caller graph for this function:

Member Data Documentation

◆ ActiveSecurities

IReadOnlyDictionary<Symbol, Security> QuantConnect.Securities.UniverseManager.ActiveSecurities
Initial value:
=> this
.SelectMany(ukvp => ukvp.Value.Members.Select(mkvp => mkvp.Value))
.DistinctBy(s => s.Symbol).ToDictionary(s => s.Symbol)

Read-only dictionary containing all active securities. An active security is a security that is currently selected by the universe or has holdings or open orders.

Definition at line 44 of file UniverseManager.cs.

◆ Count

int QuantConnect.Securities.UniverseManager.Count => _universes.Skip(0).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 139 of file UniverseManager.cs.

◆ Keys

ICollection<Symbol> QuantConnect.Securities.UniverseManager.Keys => _universes.Select(x => x.Key).ToList()

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 270 of file UniverseManager.cs.

◆ Values

ICollection<Universe> QuantConnect.Securities.UniverseManager.Values => _universes.Select(x => x.Value).ToList()

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 278 of file UniverseManager.cs.

Property Documentation

◆ IsReadOnly

bool QuantConnect.Securities.UniverseManager.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 148 of file UniverseManager.cs.

◆ this[Symbol symbol]

Universe QuantConnect.Securities.UniverseManager.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
T:System.ArgumentNullExceptionsymbol is null.
T:System.Collections.Generic.KeyNotFoundExceptionThe property is retrieved and symbol is not found.
T:System.NotSupportedExceptionThe property is set and the T:System.Collections.Generic.IDictionary`2 is read-only.

Definition at line 239 of file UniverseManager.cs.

Event Documentation

◆ CollectionChanged

NotifyCollectionChangedEventHandler QuantConnect.Securities.UniverseManager.CollectionChanged

Event fired when a universe is added or removed

Definition at line 38 of file UniverseManager.cs.


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