Lean  $LEAN_TAG$
QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler Class Reference

Pseudo realtime event processing for backtesting to simulate realtime events in fast forward. More...

Inheritance diagram for QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler:
[legend]

Public Member Functions

override void Setup (IAlgorithm algorithm, AlgorithmNodePacket job, IResultHandler resultHandler, IApi api, IIsolatorLimitResultProvider isolatorLimitProvider)
 Initializes the real time handler for the specified algorithm and job More...
 
override void Add (ScheduledEvent scheduledEvent)
 Adds the specified event to the schedule More...
 
override void Remove (ScheduledEvent scheduledEvent)
 Removes the specified event from the schedule More...
 
override void SetTime (DateTime time)
 Set the time for the realtime event handler. More...
 
override void ScanPastEvents (DateTime time)
 Scan for past events that didn't fire because there was no data at the scheduled time. More...
 
- Public Member Functions inherited from QuantConnect.Lean.Engine.RealTime.BaseRealTimeHandler
void OnSecuritiesChanged (SecurityChanges changes)
 Event fired each time that we add/remove securities from the data feed More...
 
virtual void Exit ()
 Stop the real time thread More...
 

Static Public Member Functions

static void SortFirstElement (IList< ScheduledEvent > scheduledEvents)
 Sorts the first element of the provided list and supposes the rest of the collection is sorted. Supposes the collection has at least 1 element More...
 

Properties

override bool IsActive [get, protected set]
 Flag indicating the hander thread is completely finished and ready to dispose. this doesn't run as its own thread More...
 
- Properties inherited from QuantConnect.Lean.Engine.RealTime.BaseRealTimeHandler
abstract bool IsActive [get, protected set]
 Thread status flag. More...
 
ConcurrentDictionary< ScheduledEvent, int > ScheduledEvents = new() [get]
 The scheduled events container More...
 
IIsolatorLimitResultProvider IsolatorLimitProvider [get]
 The isolator limit result provider instance More...
 
IAlgorithm Algorithm [get]
 The algorithm instance More...
 
TimeMonitor TimeMonitor [get]
 The time monitor instance to use More...
 
- Properties inherited from QuantConnect.Lean.Engine.RealTime.IRealTimeHandler
bool IsActive [get]
 Thread status flag. More...
 

Additional Inherited Members

- Protected Member Functions inherited from QuantConnect.Lean.Engine.RealTime.BaseRealTimeHandler
int GetScheduledEventUniqueId ()
 Gets a new scheduled event unique id More...
 
virtual int GetTimeMonitorTimeout ()
 Get's the timeout the scheduled task time monitor should use More...
 

Detailed Description

Pseudo realtime event processing for backtesting to simulate realtime events in fast forward.

Definition at line 32 of file BacktestingRealTimeHandler.cs.

Member Function Documentation

◆ Setup()

override void QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.Setup ( IAlgorithm  algorithm,
AlgorithmNodePacket  job,
IResultHandler  resultHandler,
IApi  api,
IIsolatorLimitResultProvider  isolatorLimitProvider 
)
virtual

Initializes the real time handler for the specified algorithm and job

Reimplemented from QuantConnect.Lean.Engine.RealTime.BaseRealTimeHandler.

Reimplemented in QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler.

Definition at line 46 of file BacktestingRealTimeHandler.cs.

◆ Add()

override void QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.Add ( ScheduledEvent  scheduledEvent)
virtual

Adds the specified event to the schedule

Parameters
scheduledEventThe event to be scheduled, including the date/times the event fires and the callback

Implements QuantConnect.Lean.Engine.RealTime.BaseRealTimeHandler.

Definition at line 67 of file BacktestingRealTimeHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Remove()

override void QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.Remove ( ScheduledEvent  scheduledEvent)
virtual

Removes the specified event from the schedule

Parameters
scheduledEventThe event to be removed

Implements QuantConnect.Lean.Engine.RealTime.BaseRealTimeHandler.

Definition at line 88 of file BacktestingRealTimeHandler.cs.

◆ SetTime()

override void QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.SetTime ( DateTime  time)
virtual

Set the time for the realtime event handler.

Parameters
timeCurrent time.

Implements QuantConnect.Lean.Engine.RealTime.BaseRealTimeHandler.

Reimplemented in QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler.

Definition at line 100 of file BacktestingRealTimeHandler.cs.

Here is the call graph for this function:

◆ ScanPastEvents()

override void QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.ScanPastEvents ( DateTime  time)
virtual

Scan for past events that didn't fire because there was no data at the scheduled time.

Parameters
timeCurrent time.

Implements QuantConnect.Lean.Engine.RealTime.BaseRealTimeHandler.

Reimplemented in QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler.

Definition at line 125 of file BacktestingRealTimeHandler.cs.

Here is the call graph for this function:

◆ SortFirstElement()

static void QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.SortFirstElement ( IList< ScheduledEvent scheduledEvents)
static

Sorts the first element of the provided list and supposes the rest of the collection is sorted. Supposes the collection has at least 1 element

Definition at line 172 of file BacktestingRealTimeHandler.cs.

Here is the caller graph for this function:

Property Documentation

◆ IsActive

override bool QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.IsActive
getprotected set

Flag indicating the hander thread is completely finished and ready to dispose. this doesn't run as its own thread

Definition at line 41 of file BacktestingRealTimeHandler.cs.


The documentation for this class was generated from the following file: