ISetupHandler
QuantConnect.Lean.Engine.Setup.ISetupHandler
Bases: IDisposable
Interface to setup the algorithm. Pass in a raw algorithm, return one with portfolio, cash, etc already preset.
errors
errors: List[Exception]
Any errors from the initialization stored here:
maximum_runtime
maximum_runtime: timedelta
Get the maximum runtime for this algorithm job.
starting_portfolio_value
starting_portfolio_value: float
Algorithm starting capital for statistics calculations
starting_date
starting_date: datetime
Start date for analysis loops to search for data.
max_orders
max_orders: int
Maximum number of orders for the algorithm run -- applicable for backtests only.
create_algorithm_instance
create_algorithm_instance(
algorithm_node_packet: AlgorithmNodePacket,
assembly_path: str,
) -> IAlgorithm
Create a new instance of an algorithm from a physical dll path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
assembly_path
|
str
|
The path to the assembly's location |
required |
algorithm_node_packet
|
AlgorithmNodePacket
|
Details of the task required |
required |
Returns:
| Type | Description |
|---|---|
IAlgorithm
|
A new instance of IAlgorithm, or throws an exception if there was an error. |
create_brokerage
create_brokerage(
algorithm_node_packet: AlgorithmNodePacket,
uninitialized_algorithm: IAlgorithm,
factory: Optional[IBrokerageFactory],
) -> Tuple[IBrokerage, IBrokerageFactory]
Creates the brokerage as specified by the job packet
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm_node_packet
|
AlgorithmNodePacket
|
Job packet |
required |
uninitialized_algorithm
|
IAlgorithm
|
The algorithm instance before Initialize has been called |
required |
factory
|
Optional[IBrokerageFactory]
|
The brokerage factory |
required |
Returns:
| Type | Description |
|---|---|
Tuple[IBrokerage, IBrokerageFactory]
|
The brokerage instance, or throws if error creating instance. |
setup
setup(parameters: SetupHandlerParameters) -> bool
Primary entry point to setup a new algorithm
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
SetupHandlerParameters
|
The parameters object to use |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True on successfully setting up the algorithm state, or false on error. |