Skip to content

LiveTradingDataFeed

QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed

Bases: FileSystemDataFeed

Provides an implementation of IDataFeed that is designed to deal with live, remote data sources

is_active

is_active: bool

Public flag indicator that the thread is still busy.

create_subscription

create_subscription(
    request: SubscriptionRequest,
) -> Subscription

Creates a new subscription to provide data for the specified security.

Parameters:

Name Type Description Default
request SubscriptionRequest

Defines the subscription to be added, including start/end times the universe and security

required

Returns:

Type Description
Subscription

The created Subscription if successful, null otherwise.

exit

exit() -> None

External controller calls to signal a terminate of the thread.

get_base_data_exchange

get_base_data_exchange() -> BaseDataExchange

Gets the BaseDataExchange to use

This codeEntityType is protected.

get_data_queue_handler

get_data_queue_handler() -> IDataQueueHandler

Gets the IDataQueueHandler to use by default DataQueueHandlerManager

This codeEntityType is protected.

Returns:

Type Description
IDataQueueHandler

The loaded IDataQueueHandler.

initialize

initialize(
    algorithm: IAlgorithm,
    job: AlgorithmNodePacket,
    result_handler: IResultHandler,
    map_file_provider: IMapFileProvider,
    factor_file_provider: IFactorFileProvider,
    data_provider: IDataProvider,
    subscription_manager: IDataFeedSubscriptionManager,
    data_feed_time_provider: IDataFeedTimeProvider,
    data_channel_provider: IDataChannelProvider,
) -> None

Initializes the data feed for the specified job and algorithm

remove_subscription

remove_subscription(subscription: Subscription) -> None

Removes the subscription from the data feed, if it exists

Parameters:

Name Type Description Default
subscription Subscription

The subscription to remove

required

add_schedule_wrapper

add_schedule_wrapper(
    request: SubscriptionRequest,
    underlying: IEnumerator[BaseData],
    time_provider: ITimeProvider,
) -> IEnumerator[BaseData]

Returns a scheduled enumerator from the given arguments. It can also return the given underlying enumerator

This codeEntityType is protected.

configure_enumerator

configure_enumerator(
    request: SubscriptionRequest,
    aggregate: bool,
    enumerator: IEnumerator[BaseData],
    fill_forward_resolution: Optional[Resolution],
    last_point_tracker: LastPointTracker,
    is_warm_up_enumerator: bool = False,
) -> IEnumerator[BaseData]

Configure the enumerator with aggregation/fill-forward/filter behaviors. Returns new instance if re-configured

This codeEntityType is protected.

configure_last_point_tracker

configure_last_point_tracker(
    enumerator: IEnumerator[BaseData],
    last_point_tracker: LastPointTracker,
    is_warm_up_enumerator: bool,
) -> IEnumerator[BaseData]

Configures the enumerator to track the last data point, if requested, and if this is a warmup enumerator

This codeEntityType is protected.

create_enumerator

create_enumerator(
    request: SubscriptionRequest,
    fill_forward_resolution: Optional[Resolution] = None,
    last_point_tracker: LastPointTracker = None,
    is_warm_up: bool = False,
) -> IEnumerator[BaseData]

Creates a file based data enumerator for the given subscription request

This codeEntityType is protected.

create_universe_enumerator

create_universe_enumerator(
    request: SubscriptionRequest,
) -> IEnumerator[BaseData]

Creates a universe enumerator from the Subscription request, the underlying enumerator func and the fill forward resolution (in some cases)

This codeEntityType is protected.

try_add_fill_forward_enumerator

try_add_fill_forward_enumerator(
    request: SubscriptionRequest,
    enumerator: IEnumerator[BaseData],
    fill_forward: bool,
    fill_forward_resolution: Optional[Resolution],
    last_point_tracker: LastPointTracker = None,
) -> IEnumerator[BaseData]

Will add a fill forward enumerator if requested

This codeEntityType is protected.