Skip to content

UniverseSelection

QuantConnect.Lean.Engine.DataFeeds.UniverseSelection

UniverseSelection(
    algorithm: IAlgorithm,
    security_service: ISecurityService,
    data_permission_manager: IDataPermissionManager,
    data_provider: IDataProvider,
    internal_config_resolution: Resolution = ...,
)

Bases: Object

Provides methods for apply the results of universe selection to an algorithm

Initializes a new instance of the UniverseSelection class

Parameters:

Name Type Description Default
algorithm IAlgorithm

The algorithm to add securities to

required
security_service ISecurityService

The security service

required
data_permission_manager IDataPermissionManager

The data permissions manager

required
data_provider IDataProvider

The data provider to use

required
internal_config_resolution Resolution

The resolution to use for internal configuration

...

add_pending_internal_data_feeds

add_pending_internal_data_feeds(
    utc_start: Union[datetime, date],
) -> bool

Will add any pending internal currency subscriptions

Parameters:

Name Type Description Default
utc_start Union[datetime, date]

The current date time in utc

required

Returns:

Type Description
bool

Will return true if any subscription was added.

apply_universe_selection

apply_universe_selection(
    universe: Universe,
    date_time_utc: Union[datetime, date],
    universe_data: BaseDataCollection,
) -> SecurityChanges

Applies universe selection the the data feed and algorithm

Parameters:

Name Type Description Default
universe Universe

The universe to perform selection on

required
date_time_utc Union[datetime, date]

The current date time in utc

required
universe_data BaseDataCollection

The data provided to perform selection with

required

ensure_currency_data_feeds

ensure_currency_data_feeds(
    security_changes: SecurityChanges,
) -> None

Checks the current subscriptions and adds necessary currency pair feeds to provide real time conversion data

handle_delisting

handle_delisting(
    data: BaseData, is_internal_feed: bool
) -> SecurityChanges

Handles the delisting process of the given data symbol from the algorithm securities

set_data_manager

set_data_manager(
    data_manager: IDataFeedSubscriptionManager,
) -> None

Sets the data manager