Lean  $LEAN_TAG$
QuantConnect.Data.UniverseSelection.Universe Class Referenceabstract

Provides a base class for all universes to derive from. More...

Inheritance diagram for QuantConnect.Data.UniverseSelection.Universe:
[legend]

Classes

class  Member
 Member of the Universe More...
 
class  SelectionEventArgs
 Event fired when the universe selection changes More...
 
class  UnchangedUniverse
 Provides a value to indicate that no changes should be made to the universe. This value is intended to be returned by reference via Universe.SelectSymbols More...
 

Public Member Functions

virtual bool CanRemoveMember (DateTime utcTime, Security security)
 Determines whether or not the specified security can be removed from this universe. This is useful to prevent securities from being taken out of a universe before the algorithm has had enough time to make decisions on the security More...
 
IEnumerable< SymbolPerformSelection (DateTime utcTime, BaseDataCollection data)
 Performs universe selection using the data specified More...
 
abstract IEnumerable< SymbolSelectSymbols (DateTime utcTime, BaseDataCollection data)
 Performs universe selection using the data specified More...
 
virtual Security CreateSecurity (Symbol symbol, IAlgorithm algorithm, MarketHoursDatabase marketHoursDatabase, SymbolPropertiesDatabase symbolPropertiesDatabase)
 Creates and configures a security for the specified symbol More...
 
virtual IEnumerable< SubscriptionRequestGetSubscriptionRequests (Security security, DateTime currentTimeUtc, DateTime maximumEndTimeUtc)
 Gets the subscription requests to be added for the specified security More...
 
virtual IEnumerable< SubscriptionRequestGetSubscriptionRequests (Security security, DateTime currentTimeUtc, DateTime maximumEndTimeUtc, ISubscriptionDataConfigService subscriptionService)
 Gets the subscription requests to be added for the specified security More...
 
bool ContainsMember (Symbol symbol)
 Determines whether or not the specified symbol is currently a member of this universe More...
 
virtual void Dispose ()
 Marks this universe as disposed and ready to remove all child subscriptions More...
 

Public Attributes

SecurityType SecurityType => Configuration.SecurityType
 Gets the security type of this universe More...
 
string Market => Configuration.Market
 Gets the market of this universe More...
 
Symbol Symbol => Configuration.Symbol
 Gets the symbol of this universe More...
 
Type DataType => Configuration.Type
 Gets the data type of this universe More...
 

Static Public Attributes

static readonly UnchangedUniverse Unchanged = UnchangedUniverse.Instance
 Gets a value indicating that no change to the universe should be made More...
 

Protected Member Functions

 Universe (SubscriptionDataConfig config)
 Initializes a new instance of the Universe class More...
 
void OnSelectionChanged (HashSet< Symbol > selection=null)
 Event invocator for the SelectionChanged event More...
 

Properties

virtual ConcurrentDictionary< Symbol, MemberSecurities [get]
 Gets the internal security collection used to define membership in this universe More...
 
HashSet< SymbolSelected [get, set]
 The currently selected symbol set More...
 
virtual bool Asynchronous [get, set]
 True if this universe filter can run async in the data stack More...
 
virtual bool DisposeRequested [get, protected set]
 Flag indicating if disposal of this universe has been requested More...
 
virtual UniverseSettings UniverseSettings [get, set]
 Gets the settings used for subscriptions added for this universe More...
 
virtual SubscriptionDataConfig Configuration [get]
 Gets the configuration used to get universe data More...
 
Dictionary< Symbol, SecurityMembers [get]
 Gets the current listing of members in this universe. Modifications to this dictionary do not change universe membership. More...
 

Events

EventHandler SelectionChanged
 Event fired when the universe selection has changed More...
 

Detailed Description

Provides a base class for all universes to derive from.

Definition at line 30 of file Universe.cs.

Constructor & Destructor Documentation

◆ Universe()

QuantConnect.Data.UniverseSelection.Universe.Universe ( SubscriptionDataConfig  config)
protected

Initializes a new instance of the Universe class

Parameters
configThe configuration used to source data for this universe

Definition at line 146 of file Universe.cs.

Here is the caller graph for this function:

Member Function Documentation

◆ CanRemoveMember()

virtual bool QuantConnect.Data.UniverseSelection.Universe.CanRemoveMember ( DateTime  utcTime,
Security  security 
)
virtual

Determines whether or not the specified security can be removed from this universe. This is useful to prevent securities from being taken out of a universe before the algorithm has had enough time to make decisions on the security

Parameters
utcTimeThe current utc time
securityThe security to check if its ok to remove
Returns
True if we can remove the security, false otherwise

Reimplemented in QuantConnect.Data.UniverseSelection.UniverseDecorator.

Definition at line 163 of file Universe.cs.

Here is the caller graph for this function:

◆ PerformSelection()

IEnumerable<Symbol> QuantConnect.Data.UniverseSelection.Universe.PerformSelection ( DateTime  utcTime,
BaseDataCollection  data 
)

Performs universe selection using the data specified

Parameters
utcTimeThe current utc time
dataThe symbols to remain in the universe
Returns
The data that passes the filter

Definition at line 203 of file Universe.cs.

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

◆ SelectSymbols()

◆ CreateSecurity()

virtual Security QuantConnect.Data.UniverseSelection.Universe.CreateSecurity ( Symbol  symbol,
IAlgorithm  algorithm,
MarketHoursDatabase  marketHoursDatabase,
SymbolPropertiesDatabase  symbolPropertiesDatabase 
)
virtual

Creates and configures a security for the specified symbol

Parameters
symbolThe symbol of the security to be created
algorithmThe algorithm instance
marketHoursDatabaseThe market hours database
symbolPropertiesDatabaseThe symbol properties database
Returns
The newly initialized security object

<obsolete>The CreateSecurity won't be called</obsolete>

Reimplemented in QuantConnect.Data.UniverseSelection.UniverseDecorator.

Definition at line 256 of file Universe.cs.

Here is the caller graph for this function:

◆ GetSubscriptionRequests() [1/2]

virtual IEnumerable<SubscriptionRequest> QuantConnect.Data.UniverseSelection.Universe.GetSubscriptionRequests ( Security  security,
DateTime  currentTimeUtc,
DateTime  maximumEndTimeUtc 
)
virtual

Gets the subscription requests to be added for the specified security

Parameters
securityThe security to get subscriptions for
currentTimeUtcThe current time in utc. This is the frontier time of the algorithm
maximumEndTimeUtcThe max end time
Returns
All subscriptions required by this security

Reimplemented in QuantConnect.Data.UniverseSelection.UniverseDecorator, and QuantConnect.Data.UniverseSelection.GetSubscriptionRequestsUniverseDecorator.

Definition at line 270 of file Universe.cs.

Here is the caller graph for this function:

◆ GetSubscriptionRequests() [2/2]

virtual IEnumerable<SubscriptionRequest> QuantConnect.Data.UniverseSelection.Universe.GetSubscriptionRequests ( Security  security,
DateTime  currentTimeUtc,
DateTime  maximumEndTimeUtc,
ISubscriptionDataConfigService  subscriptionService 
)
virtual

Gets the subscription requests to be added for the specified security

Parameters
securityThe security to get subscriptions for
currentTimeUtcThe current time in utc. This is the frontier time of the algorithm
maximumEndTimeUtcThe max end time
subscriptionServiceInstance which implements ISubscriptionDataConfigService interface
Returns
All subscriptions required by this security

Reimplemented in QuantConnect.Data.UniverseSelection.UserDefinedUniverse, QuantConnect.Data.UniverseSelection.OptionChainUniverse, QuantConnect.Data.UniverseSelection.UniversePythonWrapper, QuantConnect.Data.UniverseSelection.FuturesChainUniverse, QuantConnect.Data.UniverseSelection.ContinuousContractUniverse, QuantConnect.Data.UniverseSelection.UniverseDecorator, QuantConnect.Algorithm.Framework.Selection.ManualUniverse, and QuantConnect.Algorithm.Framework.Selection.CustomUniverse.

Definition at line 285 of file Universe.cs.

Here is the call graph for this function:

◆ ContainsMember()

bool QuantConnect.Data.UniverseSelection.Universe.ContainsMember ( Symbol  symbol)

Determines whether or not the specified symbol is currently a member of this universe

Parameters
symbolThe symbol whose membership is to be checked
Returns
True if the specified symbol is part of this universe, false otherwise

Definition at line 311 of file Universe.cs.

Here is the caller graph for this function:

◆ Dispose()

virtual void QuantConnect.Data.UniverseSelection.Universe.Dispose ( )
virtual

Marks this universe as disposed and ready to remove all child subscriptions

Definition at line 362 of file Universe.cs.

Here is the caller graph for this function:

◆ OnSelectionChanged()

void QuantConnect.Data.UniverseSelection.Universe.OnSelectionChanged ( HashSet< Symbol selection = null)
protected

Event invocator for the SelectionChanged event

Parameters
selectionThe current universe selection

Definition at line 371 of file Universe.cs.

Here is the caller graph for this function:

Member Data Documentation

◆ Unchanged

readonly UnchangedUniverse QuantConnect.Data.UniverseSelection.Universe.Unchanged = UnchangedUniverse.Instance
static

Gets a value indicating that no change to the universe should be made

Definition at line 41 of file Universe.cs.

◆ SecurityType

SecurityType QuantConnect.Data.UniverseSelection.Universe.SecurityType => Configuration.SecurityType

Gets the security type of this universe

Definition at line 91 of file Universe.cs.

◆ Market

string QuantConnect.Data.UniverseSelection.Universe.Market => Configuration.Market

Gets the market of this universe

Definition at line 96 of file Universe.cs.

◆ Symbol

Symbol QuantConnect.Data.UniverseSelection.Universe.Symbol => Configuration.Symbol

Gets the symbol of this universe

Definition at line 101 of file Universe.cs.

◆ DataType

Type QuantConnect.Data.UniverseSelection.Universe.DataType => Configuration.Type

Gets the data type of this universe

Definition at line 106 of file Universe.cs.

Property Documentation

◆ Securities

virtual ConcurrentDictionary<Symbol, Member> QuantConnect.Data.UniverseSelection.Universe.Securities
get

Gets the internal security collection used to define membership in this universe

Definition at line 49 of file Universe.cs.

◆ Selected

HashSet<Symbol> QuantConnect.Data.UniverseSelection.Universe.Selected
getset

The currently selected symbol set

This set might be different than Securities which might hold members that are no longer selected but have not been removed yet, this can be because they have some open position, orders, haven't completed the minimum time in universe

Definition at line 60 of file Universe.cs.

◆ Asynchronous

virtual bool QuantConnect.Data.UniverseSelection.Universe.Asynchronous
getset

True if this universe filter can run async in the data stack

Definition at line 68 of file Universe.cs.

◆ DisposeRequested

virtual bool QuantConnect.Data.UniverseSelection.Universe.DisposeRequested
getprotected set

Flag indicating if disposal of this universe has been requested

Definition at line 112 of file Universe.cs.

◆ UniverseSettings

virtual UniverseSettings QuantConnect.Data.UniverseSelection.Universe.UniverseSettings
getset

Gets the settings used for subscriptions added for this universe

Definition at line 121 of file Universe.cs.

◆ Configuration

virtual SubscriptionDataConfig QuantConnect.Data.UniverseSelection.Universe.Configuration
get

Gets the configuration used to get universe data

Definition at line 129 of file Universe.cs.

◆ Members

Dictionary<Symbol, Security> QuantConnect.Data.UniverseSelection.Universe.Members
get

Gets the current listing of members in this universe. Modifications to this dictionary do not change universe membership.

Definition at line 138 of file Universe.cs.

Event Documentation

◆ SelectionChanged

EventHandler QuantConnect.Data.UniverseSelection.Universe.SelectionChanged

Event fired when the universe selection has changed

Definition at line 86 of file Universe.cs.


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