FuturesChainUniverse
QuantConnect.Data.UniverseSelection.FuturesChainUniverse
FuturesChainUniverse(
future: Future, universe_settings: UniverseSettings
)
Bases: Universe
Defines a universe for a single futures chain
Initializes a new instance of the FuturesChainUniverse class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
future
|
Future
|
The canonical future chain security |
required |
universe_settings
|
UniverseSettings
|
The universe settings to be used for new subscriptions |
required |
asynchronous
asynchronous: bool
True if this universe filter can run async in the data stack
universe_settings
universe_settings: UniverseSettings
Gets the settings used for subscriptons added for this universe
UNCHANGED
UNCHANGED: UnchangedUniverse = ...
Gets a value indicating that no change to the universe should be made
securities
Gets the internal security collection used to define membership in this universe
selection_changed
selection_changed: _EventContainer[
Callable[[Object, EventArgs], Any], Any
]
Event fired when the universe selection has changed
market
market: str
Gets the market of this universe
data_type
data_type: Type
Gets the data type of this universe
dispose_requested
dispose_requested: bool
Flag indicating if disposal of this universe has been requested
configuration
configuration: SubscriptionDataConfig
Gets the configuration used to get universe data
members
Gets the current listing of members in this universe. Modifications to this dictionary do not change universe membership.
UnchangedUniverse
Bases: Object, Iterable[str]
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.select_symbols
Member
Member(
added: Union[datetime, date],
security: Security,
is_internal: bool,
)
Bases: Object
Member of the Universe
Initialize a new member for the universe
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
added
|
Union[datetime, date]
|
DateTime added |
required |
security
|
Security
|
Security to add |
required |
is_internal
|
bool
|
True if internal member |
required |
added
added: datetime
DateTime when added
is_internal
is_internal: bool
True if the security was added as internal by this universe
SelectionEventArgs
SelectionEventArgs(current_selection: HashSet[Symbol])
Bases: EventArgs
Event fired when the universe selection changes
Creates a new instance
select_symbols
select_symbols(
utc_time: Union[datetime, date],
data: BaseDataCollection,
) -> Iterable[Symbol]
Performs universe selection using the data specified
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
utc_time
|
Union[datetime, date]
|
The current utc time |
required |
data
|
BaseDataCollection
|
The symbols to remain in the universe |
required |
Returns:
| Type | Description |
|---|---|
Iterable[Symbol]
|
The data that passes the filter. |
get_subscription_requests
get_subscription_requests(
security: Security,
current_time_utc: Union[datetime, date],
maximum_end_time_utc: Union[datetime, date],
subscription_service: ISubscriptionDataConfigService,
) -> Iterable[SubscriptionRequest]
get_subscription_requests(
security: Security,
current_time_utc: Union[datetime, date],
maximum_end_time_utc: Union[datetime, date],
) -> Iterable[SubscriptionRequest]
Gets the subscription requests to be added for the specified security
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
security
|
Security
|
The security to get subscriptions for |
required |
current_time_utc
|
Union[datetime, date]
|
The current time in utc. This is the frontier time of the algorithm |
required |
maximum_end_time_utc
|
Union[datetime, date]
|
The max end time |
required |
subscription_service
|
Optional[ISubscriptionDataConfigService]
|
Instance which implements ISubscriptionDataConfigService interface |
None
|
Returns:
| Type | Description |
|---|---|
Iterable[SubscriptionRequest]
|
All subscriptions required by this security. |
can_remove_member
can_remove_member(
utc_time: Union[datetime, date], security: Security
) -> bool
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:
| Name | Type | Description | Default |
|---|---|---|---|
utc_time
|
Union[datetime, date]
|
The current utc time |
required |
security
|
Security
|
The security to check if its ok to remove |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if we can remove the security, false otherwise. |
contains_member
contains_member(
symbol: Union[Symbol, str, BaseContract],
) -> bool
Determines whether or not the specified symbol is currently a member of this universe
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
Union[Symbol, str, BaseContract]
|
The symbol whose membership is to be checked |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the specified symbol is part of this universe, false otherwise. |
create_security
create_security(
symbol: Union[Symbol, str, BaseContract],
algorithm: IAlgorithm,
market_hours_database: MarketHoursDatabase,
symbol_properties_database: SymbolPropertiesDatabase,
) -> Security
Creates and configures a security for the specified symbol
CreateSecurity is obsolete and will not be called. The system will create the required Securities based on selected symbols
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
Union[Symbol, str, BaseContract]
|
The symbol of the security to be created |
required |
algorithm
|
IAlgorithm
|
The algorithm instance |
required |
market_hours_database
|
MarketHoursDatabase
|
The market hours database |
required |
symbol_properties_database
|
SymbolPropertiesDatabase
|
The symbol properties database |
required |
Returns:
| Type | Description |
|---|---|
Security
|
The newly initialized security object. |
dispose
dispose() -> None
Marks this universe as disposed and ready to remove all child subscriptions
on_selection_changed
on_selection_changed(
selection: HashSet[Symbol] = None,
) -> None
Event invocator for the selection_changed event
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection
|
HashSet[Symbol]
|
The current universe selection |
None
|
perform_selection
perform_selection(
utc_time: Union[datetime, date],
data: BaseDataCollection,
) -> Iterable[Symbol]
Performs universe selection using the data specified
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
utc_time
|
Union[datetime, date]
|
The current utc time |
required |
data
|
BaseDataCollection
|
The symbols to remain in the universe |
required |
Returns:
| Type | Description |
|---|---|
Iterable[Symbol]
|
The data that passes the filter. |