Lean  $LEAN_TAG$
QuantConnect.Data.UniverseSelection.UserDefinedUniverse Class Reference

Represents the universe defined by the user's algorithm. This is the default universe where manually added securities live by market/security type. They can also be manually generated and can be configured to fire on certain interval and will always return the internal list of symbols. More...

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

Public Member Functions

 UserDefinedUniverse (SubscriptionDataConfig configuration, UniverseSettings universeSettings, TimeSpan interval, IEnumerable< Symbol > symbols)
 Initializes a new instance of the UserDefinedUniverse class More...
 
 UserDefinedUniverse (SubscriptionDataConfig configuration, UniverseSettings universeSettings, TimeSpan interval, Func< DateTime, IEnumerable< string >> selector)
 Initializes a new instance of the UserDefinedUniverse class More...
 
bool Add (Symbol symbol)
 Adds the specified Symbol to this universe More...
 
bool Add (SubscriptionDataConfig subscriptionDataConfig)
 Adds the specified SubscriptionDataConfig to this universe More...
 
bool Remove (Symbol symbol)
 Removes the specified Symbol from this universe More...
 
override IEnumerable< SymbolSelectSymbols (DateTime utcTime, BaseDataCollection data)
 Returns the symbols defined by the user for this universe More...
 
virtual IEnumerable< DateTime > GetTriggerTimes (DateTime startTimeUtc, DateTime endTimeUtc, MarketHoursDatabase marketHoursDatabase)
 Returns an enumerator that defines when this user defined universe will be invoked More...
 
override IEnumerable< SubscriptionRequestGetSubscriptionRequests (Security security, DateTime currentTimeUtc, DateTime maximumEndTimeUtc, ISubscriptionDataConfigService subscriptionService)
 Gets the subscription requests to be added for the specified security More...
 
- Public Member Functions inherited from QuantConnect.Data.UniverseSelection.Universe
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...
 
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...
 
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...
 

Static Public Member Functions

static Symbol CreateSymbol (SecurityType securityType, string market)
 Creates a user defined universe symbol More...
 

Protected Member Functions

virtual void OnCollectionChanged (NotifyCollectionChangedEventArgs e)
 Event invocator for the CollectionChanged event More...
 
- Protected Member Functions inherited from QuantConnect.Data.UniverseSelection.Universe
 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

TimeSpan Interval [get]
 Gets the interval of this user defined universe More...
 
- Properties inherited from QuantConnect.Data.UniverseSelection.Universe
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

NotifyCollectionChangedEventHandler CollectionChanged
 Event fired when a symbol is added or removed from this universe More...
 
- Events inherited from QuantConnect.Data.UniverseSelection.Universe
EventHandler SelectionChanged
 Event fired when the universe selection has changed More...
 

Additional Inherited Members

- Public Attributes inherited from QuantConnect.Data.UniverseSelection.Universe
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 inherited from QuantConnect.Data.UniverseSelection.Universe
static readonly UnchangedUniverse Unchanged = UnchangedUniverse.Instance
 Gets a value indicating that no change to the universe should be made More...
 

Detailed Description

Represents the universe defined by the user's algorithm. This is the default universe where manually added securities live by market/security type. They can also be manually generated and can be configured to fire on certain interval and will always return the internal list of symbols.

Definition at line 33 of file UserDefinedUniverse.cs.

Constructor & Destructor Documentation

◆ UserDefinedUniverse() [1/2]

QuantConnect.Data.UniverseSelection.UserDefinedUniverse.UserDefinedUniverse ( SubscriptionDataConfig  configuration,
UniverseSettings  universeSettings,
TimeSpan  interval,
IEnumerable< Symbol symbols 
)

Initializes a new instance of the UserDefinedUniverse class

Parameters
configurationThe configuration used to resolve the data for universe selection
universeSettingsThe settings used for new subscriptions generated by this universe
intervalThe interval at which selection should be performed
symbolsThe initial set of symbols in this universe

Definition at line 64 of file UserDefinedUniverse.cs.

◆ UserDefinedUniverse() [2/2]

QuantConnect.Data.UniverseSelection.UserDefinedUniverse.UserDefinedUniverse ( SubscriptionDataConfig  configuration,
UniverseSettings  universeSettings,
TimeSpan  interval,
Func< DateTime, IEnumerable< string >>  selector 
)

Initializes a new instance of the UserDefinedUniverse class

Parameters
configurationThe configuration used to resolve the data for universe selection
universeSettingsThe settings used for new subscriptions generated by this universe
intervalThe interval at which selection should be performed
selectorUniverse selection function invoked for each time returned via GetTriggerTimes. The function parameter is a DateTime in the time zone of configuration.ExchangeTimeZone

Definition at line 87 of file UserDefinedUniverse.cs.

Here is the call graph for this function:

Member Function Documentation

◆ CreateSymbol()

static Symbol QuantConnect.Data.UniverseSelection.UserDefinedUniverse.CreateSymbol ( SecurityType  securityType,
string  market 
)
static

Creates a user defined universe symbol

Parameters
securityTypeThe security
marketThe market
Returns
A symbol for user defined universe of the specified security type and market

Definition at line 107 of file UserDefinedUniverse.cs.

Here is the call graph for this function:

◆ Add() [1/2]

bool QuantConnect.Data.UniverseSelection.UserDefinedUniverse.Add ( Symbol  symbol)

Adds the specified Symbol to this universe

Parameters
symbolThe symbol to be added to this universe
Returns
True if the symbol was added, false if it was already present

Definition at line 118 of file UserDefinedUniverse.cs.

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

◆ Add() [2/2]

bool QuantConnect.Data.UniverseSelection.UserDefinedUniverse.Add ( SubscriptionDataConfig  subscriptionDataConfig)

Adds the specified SubscriptionDataConfig to this universe

Parameters
subscriptionDataConfigThe subscription data configuration to be added to this universe
Returns
True if the subscriptionDataConfig was added, false if it was already present

Definition at line 140 of file UserDefinedUniverse.cs.

Here is the call graph for this function:

◆ Remove()

bool QuantConnect.Data.UniverseSelection.UserDefinedUniverse.Remove ( Symbol  symbol)

Removes the specified Symbol from this universe

Parameters
symbolThe symbol to be removed
Returns
True if the symbol was removed, false if the symbol was not present

Definition at line 162 of file UserDefinedUniverse.cs.

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

◆ SelectSymbols()

override IEnumerable<Symbol> QuantConnect.Data.UniverseSelection.UserDefinedUniverse.SelectSymbols ( DateTime  utcTime,
BaseDataCollection  data 
)
virtual

Returns the symbols defined by the user for this universe

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

Implements QuantConnect.Data.UniverseSelection.Universe.

Definition at line 178 of file UserDefinedUniverse.cs.

◆ GetTriggerTimes()

virtual IEnumerable<DateTime> QuantConnect.Data.UniverseSelection.UserDefinedUniverse.GetTriggerTimes ( DateTime  startTimeUtc,
DateTime  endTimeUtc,
MarketHoursDatabase  marketHoursDatabase 
)
virtual

Returns an enumerator that defines when this user defined universe will be invoked

Returns
An enumerator of DateTime that defines when this universe will be invoked

Implements QuantConnect.Data.UniverseSelection.ITimeTriggeredUniverse.

Definition at line 187 of file UserDefinedUniverse.cs.

Here is the call graph for this function:

◆ OnCollectionChanged()

virtual void QuantConnect.Data.UniverseSelection.UserDefinedUniverse.OnCollectionChanged ( NotifyCollectionChangedEventArgs  e)
protectedvirtual

Event invocator for the CollectionChanged event

Parameters
eThe notify collection changed event arguments

Reimplemented in QuantConnect.Algorithm.Selection.OptionContractUniverse.

Definition at line 212 of file UserDefinedUniverse.cs.

Here is the caller graph for this function:

◆ GetSubscriptionRequests()

override IEnumerable<SubscriptionRequest> QuantConnect.Data.UniverseSelection.UserDefinedUniverse.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 from QuantConnect.Data.UniverseSelection.Universe.

Definition at line 225 of file UserDefinedUniverse.cs.

Property Documentation

◆ Interval

TimeSpan QuantConnect.Data.UniverseSelection.UserDefinedUniverse.Interval
get

Gets the interval of this user defined universe

Definition at line 53 of file UserDefinedUniverse.cs.

Event Documentation

◆ CollectionChanged

NotifyCollectionChangedEventHandler QuantConnect.Data.UniverseSelection.UserDefinedUniverse.CollectionChanged

Event fired when a symbol is added or removed from this universe

Definition at line 47 of file UserDefinedUniverse.cs.


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