Lean
$LEAN_TAG$
|
Base class for the real time handler LiveTradingRealTimeHandler and BacktestingRealTimeHandler implementations More...
Public Member Functions | |
abstract void | Add (ScheduledEvent scheduledEvent) |
Adds the specified event to the schedule More... | |
abstract void | Remove (ScheduledEvent scheduledEvent) |
Removes the specified event from the schedule More... | |
abstract void | SetTime (DateTime time) |
Set the current time for the event scanner (so we can use same code for backtesting and live events) More... | |
abstract void | ScanPastEvents (DateTime time) |
Scan for past events that didn't fire because there was no data at the scheduled time. More... | |
virtual void | Setup (IAlgorithm algorithm, AlgorithmNodePacket job, IResultHandler resultHandler, IApi api, IIsolatorLimitResultProvider isolatorLimitProvider) |
Initializes the real time handler for the specified algorithm and job. Adds EndOfDayEvents More... | |
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... | |
Protected Member Functions | |
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... | |
Properties | |
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... | |
Base class for the real time handler LiveTradingRealTimeHandler and BacktestingRealTimeHandler implementations
Definition at line 37 of file BaseRealTimeHandler.cs.
|
pure virtual |
Adds the specified event to the schedule
scheduledEvent | The event to be scheduled, including the date/times the event fires and the callback |
Implements QuantConnect.Scheduling.IEventSchedule.
Implemented in QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.
|
pure virtual |
Removes the specified event from the schedule
scheduledEvent | The event to be removed |
Implements QuantConnect.Scheduling.IEventSchedule.
Implemented in QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.
|
pure virtual |
Set the current time for the event scanner (so we can use same code for backtesting and live events)
time | Current real or backtest time. |
Implements QuantConnect.Lean.Engine.RealTime.IRealTimeHandler.
Implemented in QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler, and QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.
|
pure virtual |
Scan for past events that didn't fire because there was no data at the scheduled time.
time | Current time. |
Implements QuantConnect.Lean.Engine.RealTime.IRealTimeHandler.
Implemented in QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler, and QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.
|
virtual |
Initializes the real time handler for the specified algorithm and job. Adds EndOfDayEvents
Implements QuantConnect.Lean.Engine.RealTime.IRealTimeHandler.
Reimplemented in QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler, and QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler.
Definition at line 118 of file BaseRealTimeHandler.cs.
|
protected |
Gets a new scheduled event unique id
This value is used to order scheduled events in a deterministic way
Definition at line 165 of file BaseRealTimeHandler.cs.
|
protectedvirtual |
Get's the timeout the scheduled task time monitor should use
Reimplemented in QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler.
Definition at line 173 of file BaseRealTimeHandler.cs.
void QuantConnect.Lean.Engine.RealTime.BaseRealTimeHandler.OnSecuritiesChanged | ( | SecurityChanges | changes | ) |
Event fired each time that we add/remove securities from the data feed
Implements QuantConnect.Lean.Engine.RealTime.IRealTimeHandler.
Definition at line 248 of file BaseRealTimeHandler.cs.
|
virtual |
Stop the real time thread
Implements QuantConnect.Lean.Engine.RealTime.IRealTimeHandler.
Reimplemented in QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler.
Definition at line 280 of file BaseRealTimeHandler.cs.
|
getprotected set |
Thread status flag.
Definition at line 64 of file BaseRealTimeHandler.cs.
|
getprotected |
The scheduled events container
Initialize this immediately since the Initialize method gets called after IAlgorithm.Initialize, so we want to be ready to accept events as soon as possible
Definition at line 72 of file BaseRealTimeHandler.cs.
|
getprotected |
The isolator limit result provider instance
Definition at line 77 of file BaseRealTimeHandler.cs.
|
getprotected |
The algorithm instance
Definition at line 82 of file BaseRealTimeHandler.cs.
|
getprotected |
The time monitor instance to use
Definition at line 87 of file BaseRealTimeHandler.cs.