AlgorithmManager
QuantConnect.Lean.Engine.AlgorithmManager
AlgorithmManager(
live_mode: bool, job: AlgorithmNodePacket = None
)
Bases: Object
Algorithm manager class executes the algorithm and generates and passes through the algorithm events.
Initializes a new instance of the AlgorithmManager class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
live_mode
|
bool
|
True if we're running in live mode, false for backtest mode |
required |
job
|
AlgorithmNodePacket
|
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 |
None
|
algorithm_id
algorithm_id: str
Public access to the currently running algorithm id.
time_limit
time_limit: AlgorithmTimeLimitManager
Provides the isolator with a function for verifying that we're not spending too much time in each algorithm manager time loop
quit_state
quit_state: bool
Quit state flag for the running algorithm. When true the user has requested the backtest stops through a Quit() method.
data_points
data_points: int
Gets the number of data points processed per second
algorithm_history_data_points
algorithm_history_data_points: int
Gets the number of data points of algorithm history provider
handle_dividends
handle_dividends(
time_slice: TimeSlice,
algorithm: IAlgorithm,
live_mode: bool,
) -> None
Helper method to apply a dividend to an algorithm instance
handle_splits
handle_splits(
time_slice: TimeSlice,
algorithm: IAlgorithm,
live_mode: bool,
) -> None
Helper method to apply a split to an algorithm instance
process_volatility_history_requirements
process_volatility_history_requirements(
algorithm: IAlgorithm, live_mode: bool
) -> None
Helper method used to process securities volatility history requirements
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm
|
IAlgorithm
|
The algorithm instance |
required |
live_mode
|
bool
|
Whether the algorithm is in live mode |
required |
run
run(
job: AlgorithmNodePacket,
algorithm: IAlgorithm,
synchronizer: ISynchronizer,
transactions: ITransactionHandler,
results: IResultHandler,
realtime: IRealTimeHandler,
lean_manager: ILeanManager,
cancellation_token_source: CancellationTokenSource,
performance_tracking_tool: PerformanceTrackingTool,
) -> None
Launch the algorithm manager to run this strategy
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job
|
AlgorithmNodePacket
|
Algorithm job |
required |
algorithm
|
IAlgorithm
|
Algorithm instance |
required |
synchronizer
|
ISynchronizer
|
Instance which implements ISynchronizer. Used to stream the data |
required |
transactions
|
ITransactionHandler
|
Transaction manager object |
required |
results
|
IResultHandler
|
Result handler object |
required |
realtime
|
IRealTimeHandler
|
Realtime processing object |
required |
lean_manager
|
ILeanManager
|
ILeanManager implementation that is updated periodically with the IAlgorithm instance |
required |
cancellation_token_source
|
CancellationTokenSource
|
Cancellation token source to monitor |
required |