IRealTimeHandler
QuantConnect.Lean.Engine.RealTime.IRealTimeHandler
Bases: IEventSchedule
Real time event handler, trigger functions at regular or pretimed intervals
is_active
is_active: bool
Thread status flag.
exit
exit() -> None
Trigger and exit signal to terminate real time event scanner.
on_securities_changed
on_securities_changed(changes: SecurityChanges) -> None
Event fired each time that we add/remove securities from the data feed
scan_past_events
scan_past_events(time: Union[datetime, date]) -> None
Scan for past events that didn't fire because there was no data at the scheduled time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
Union[datetime, date]
|
Current time. |
required |
set_time
set_time(time: Union[datetime, date]) -> None
Set the current time for the event scanner (so we can use same code for backtesting and live events)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
Union[datetime, date]
|
Current real or backtest time. |
required |
setup
setup(
algorithm: IAlgorithm,
job: AlgorithmNodePacket,
result_handler: IResultHandler,
api: IApi,
isolator_limit_provider: IIsolatorLimitResultProvider,
) -> None
Initializes the real time handler for the specified algorithm and job
add
add(scheduled_event: ScheduledEvent) -> None
Adds the specified event to the schedule
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scheduled_event
|
ScheduledEvent
|
The event to be scheduled, including the date/times the event fires and the callback |
required |
remove
remove(scheduled_event: ScheduledEvent) -> None
Removes the specified event from the schedule
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scheduled_event
|
ScheduledEvent
|
The event to be removed |
required |