SubscriptionSynchronizer
QuantConnect.Lean.Engine.DataFeeds.SubscriptionSynchronizer
SubscriptionSynchronizer(
universe_selection: UniverseSelection,
performance_tracking_tool: PerformanceTrackingTool,
)
Bases: Object, ISubscriptionSynchronizer, ITimeProvider
Provides the ability to synchronize subscriptions into time slices
Initializes a new instance of the SubscriptionSynchronizer class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
universe_selection
|
UniverseSelection
|
The universe selection instance used to handle universe selection subscription output |
required |
Returns:
| Type | Description |
|---|---|
None
|
A time slice for the specified frontier time. |
subscription_finished
subscription_finished: _EventContainer[
Callable[[Object, Subscription], Any], Any
]
Event fired when a Subscription is finished
get_utc_now
get_utc_now() -> datetime
Returns the current UTC frontier time
on_subscription_finished
on_subscription_finished(
subscription: Subscription,
) -> None
Event invocator for the subscription_finished event
This codeEntityType is protected.
set_time_provider
set_time_provider(time_provider: ITimeProvider) -> None
Sets the time provider. If already set will throw.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_provider
|
ITimeProvider
|
The time provider, used to obtain the current frontier UTC value |
required |
set_time_slice_factory
set_time_slice_factory(
time_slice_factory: TimeSliceFactory,
) -> None
Sets the TimeSliceFactory instance to use
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_slice_factory
|
TimeSliceFactory
|
Used to create the new TimeSlice |
required |
sync
sync(
subscriptions: List[Subscription],
cancellation_token: CancellationToken,
) -> Iterable[TimeSlice]
Syncs the specified subscriptions. The frontier time used for synchronization is managed internally and dependent upon previous synchronization operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subscriptions
|
List[Subscription]
|
The subscriptions to sync |
required |
cancellation_token
|
CancellationToken
|
The cancellation token to stop enumeration |
required |