Lean
$LEAN_TAG$
|
Algorithm manager class executes the algorithm and generates and passes through the algorithm events. More...
Public Member Functions | |
AlgorithmManager (bool liveMode, AlgorithmNodePacket job=null) | |
Initializes a new instance of the AlgorithmManager class More... | |
void | Run (AlgorithmNodePacket job, IAlgorithm algorithm, ISynchronizer synchronizer, ITransactionHandler transactions, IResultHandler results, IRealTimeHandler realtime, ILeanManager leanManager, CancellationTokenSource cancellationTokenSource) |
Launch the algorithm manager to run this strategy More... | |
void | SetStatus (AlgorithmStatus state) |
Set the quit state. More... | |
Static Public Member Functions | |
static void | ProcessVolatilityHistoryRequirements (IAlgorithm algorithm, bool liveMode) |
Helper method used to process securities volatility history requirements More... | |
static void | HandleSplits (TimeSlice timeSlice, IAlgorithm algorithm, bool liveMode) |
Helper method to apply a split to an algorithm instance More... | |
static void | HandleDividends (TimeSlice timeSlice, IAlgorithm algorithm, bool liveMode) |
Helper method to apply a dividend to an algorithm instance More... | |
Public Attributes | |
AlgorithmStatus | State => _algorithm?.Status ?? AlgorithmStatus.Running |
Publicly accessible algorithm status More... | |
bool | QuitState => State == AlgorithmStatus.Deleted |
Quit state flag for the running algorithm. When true the user has requested the backtest stops through a Quit() method. More... | |
int | AlgorithmHistoryDataPoints => _algorithm?.HistoryProvider?.DataPointCount ?? 0 |
Gets the number of data points of algorithm history provider More... | |
Properties | |
string | AlgorithmId [get] |
Public access to the currently running algorithm id. More... | |
AlgorithmTimeLimitManager | TimeLimit [get] |
Provides the isolator with a function for verifying that we're not spending too much time in each algorithm manager time loop More... | |
long | DataPoints [get] |
Gets the number of data points processed per second More... | |
Algorithm manager class executes the algorithm and generates and passes through the algorithm events.
Definition at line 46 of file AlgorithmManager.cs.
QuantConnect.Lean.Engine.AlgorithmManager.AlgorithmManager | ( | bool | liveMode, |
AlgorithmNodePacket | job = null |
||
) |
Initializes a new instance of the AlgorithmManager class
liveMode | True if we're running in live mode, false for backtest mode |
job | Provided by LEAN when creating a new algo manager. This is the job that the algo manager is about to execute. Research and other consumers can provide the default value of null |
Definition at line 93 of file AlgorithmManager.cs.
void QuantConnect.Lean.Engine.AlgorithmManager.Run | ( | AlgorithmNodePacket | job, |
IAlgorithm | algorithm, | ||
ISynchronizer | synchronizer, | ||
ITransactionHandler | transactions, | ||
IResultHandler | results, | ||
IRealTimeHandler | realtime, | ||
ILeanManager | leanManager, | ||
CancellationTokenSource | cancellationTokenSource | ||
) |
Launch the algorithm manager to run this strategy
job | Algorithm job |
algorithm | Algorithm instance |
synchronizer | Instance which implements ISynchronizer. Used to stream the data |
transactions | Transaction manager object |
results | Result handler object |
realtime | Realtime processing object |
leanManager | ILeanManager implementation that is updated periodically with the IAlgorithm instance |
cancellationTokenSource | Cancellation token source to monitor |
Modify with caution
Definition at line 118 of file AlgorithmManager.cs.
void QuantConnect.Lean.Engine.AlgorithmManager.SetStatus | ( | AlgorithmStatus | state | ) |
Set the quit state.
Definition at line 604 of file AlgorithmManager.cs.
|
static |
Helper method used to process securities volatility history requirements
Implemented as static to facilitate testing
algorithm | The algorithm instance |
liveMode | Whether the algorithm is in live mode |
Definition at line 703 of file AlgorithmManager.cs.
|
static |
Helper method to apply a split to an algorithm instance
Definition at line 719 of file AlgorithmManager.cs.
|
static |
Helper method to apply a dividend to an algorithm instance
Definition at line 786 of file AlgorithmManager.cs.
AlgorithmStatus QuantConnect.Lean.Engine.AlgorithmManager.State => _algorithm?.Status ?? AlgorithmStatus.Running |
Publicly accessible algorithm status
Definition at line 57 of file AlgorithmManager.cs.
bool QuantConnect.Lean.Engine.AlgorithmManager.QuitState => State == AlgorithmStatus.Deleted |
Quit state flag for the running algorithm. When true the user has requested the backtest stops through a Quit() method.
Definition at line 74 of file AlgorithmManager.cs.
int QuantConnect.Lean.Engine.AlgorithmManager.AlgorithmHistoryDataPoints => _algorithm?.HistoryProvider?.DataPointCount ?? 0 |
Gets the number of data points of algorithm history provider
Definition at line 84 of file AlgorithmManager.cs.
|
get |
Public access to the currently running algorithm id.
Definition at line 62 of file AlgorithmManager.cs.
|
get |
Provides the isolator with a function for verifying that we're not spending too much time in each algorithm manager time loop
Definition at line 68 of file AlgorithmManager.cs.
|
get |
Gets the number of data points processed per second
Definition at line 79 of file AlgorithmManager.cs.