Skip to content

LiveSynchronizer

QuantConnect.Lean.Engine.DataFeeds.LiveSynchronizer

Bases: Synchronizer

Implementation of the ISynchronizer interface which provides the mechanism to stream live data to the algorithm

BATCHING_DELAY

BATCHING_DELAY: int = ...

Consumer batching timeout in ms

time_provider

time_provider: ITimeProvider

Continuous UTC time provider

frontier_time_provider

frontier_time_provider: ITimeProvider

Time provider which returns current UTC frontier time

algorithm

algorithm: IAlgorithm

The algorithm instance

This codeEntityType is protected.

subscription_manager

subscription_manager: IDataFeedSubscriptionManager

The subscription manager

This codeEntityType is protected.

subscription_synchronizer

subscription_synchronizer: SubscriptionSynchronizer

The subscription synchronizer

This codeEntityType is protected.

time_slice_factory

time_slice_factory: TimeSliceFactory

The time slice factory

This codeEntityType is protected.

dispose

dispose() -> None

Free resources

get_pulse_due_time

get_pulse_due_time(now: Union[datetime, date]) -> int

Will return the amount of milliseconds that are missing for the next time pulse

This codeEntityType is protected.

get_time_provider

get_time_provider() -> ITimeProvider

Gets the ITimeProvider to use. By default this will load the RealTimeProvider for live mode, else SubscriptionFrontierTimeProvider

This codeEntityType is protected.

Returns:

Type Description
ITimeProvider

The ITimeProvider to use.

initialize

initialize(
    algorithm: IAlgorithm,
    data_feed_subscription_manager: IDataFeedSubscriptionManager,
    performance_tracking_tool: PerformanceTrackingTool,
) -> None

Initializes the instance of the Synchronizer class

on_subscription_new_data_available

on_subscription_new_data_available(
    sender: Any, args: EventArgs
) -> None

Trigger new data event

This codeEntityType is protected.

Parameters:

Name Type Description Default
sender Any

Sender of the event

required
args EventArgs

Event information

required

post_initialize

post_initialize() -> None

Performs additional initialization steps after algorithm initialization

This codeEntityType is protected.

stream_data

stream_data(
    cancellation_token: CancellationToken,
) -> Iterable[TimeSlice]

Returns an enumerable which provides the data to stream to the algorithm