Lean
$LEAN_TAG$
|
Defines a set up handler that initializes the algorithm instance using values retrieved from the user's brokerage account More...
Public Member Functions | |
BrokerageSetupHandler () | |
Initializes a new BrokerageSetupHandler More... | |
IAlgorithm | CreateAlgorithmInstance (AlgorithmNodePacket algorithmNodePacket, string assemblyPath) |
Create a new instance of an algorithm from a physical dll path. More... | |
IBrokerage | CreateBrokerage (AlgorithmNodePacket algorithmNodePacket, IAlgorithm uninitializedAlgorithm, out IBrokerageFactory factory) |
Creates the brokerage as specified by the job packet More... | |
bool | Setup (SetupHandlerParameters parameters) |
Primary entry point to setup a new algorithm More... | |
void | Dispose () |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More... | |
Static Public Attributes | |
static string | MaxAllocationLimitConfig = "max-allocation-limit" |
Max allocation limit configuration variable name More... | |
Protected Member Functions | |
bool | LoadExistingHoldingsAndOrders (IBrokerage brokerage, IAlgorithm algorithm, SetupHandlerParameters parameters) |
Loads existing holdings and orders More... | |
void | GetOpenOrders (IAlgorithm algorithm, IResultHandler resultHandler, ITransactionHandler transactionHandler, IBrokerage brokerage) |
Get the open orders from a brokerage. Adds Orders.Order and Orders.OrderTicket to the transaction handler More... | |
Properties | |
WorkerThread | WorkerThread [get, set] |
The worker thread instance the setup handler should use More... | |
List< Exception > | Errors [get, set] |
Any errors from the initialization stored here: More... | |
TimeSpan | MaximumRuntime [get] |
Get the maximum runtime for this algorithm job. More... | |
decimal | StartingPortfolioValue [get] |
Algorithm starting capital for statistics calculations More... | |
DateTime | StartingDate [get] |
Start date for analysis loops to search for data. More... | |
int | MaxOrders [get] |
Maximum number of orders for the algorithm run – applicable for backtests only. More... | |
Properties inherited from QuantConnect.Lean.Engine.Setup.ISetupHandler | |
WorkerThread | WorkerThread [set] |
The worker thread instance the setup handler should use More... | |
List< Exception > | Errors [get, set] |
Any errors from the initialization stored here: More... | |
TimeSpan | MaximumRuntime [get] |
Get the maximum runtime for this algorithm job. More... | |
decimal | StartingPortfolioValue [get] |
Algorithm starting capital for statistics calculations More... | |
DateTime | StartingDate [get] |
Start date for analysis loops to search for data. More... | |
int | MaxOrders [get] |
Maximum number of orders for the algorithm run – applicable for backtests only. More... | |
Defines a set up handler that initializes the algorithm instance using values retrieved from the user's brokerage account
Definition at line 41 of file BrokerageSetupHandler.cs.
QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler.BrokerageSetupHandler | ( | ) |
Initializes a new BrokerageSetupHandler
Definition at line 85 of file BrokerageSetupHandler.cs.
IAlgorithm QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler.CreateAlgorithmInstance | ( | AlgorithmNodePacket | algorithmNodePacket, |
string | assemblyPath | ||
) |
Create a new instance of an algorithm from a physical dll path.
assemblyPath | The path to the assembly's location |
algorithmNodePacket | Details of the task required |
Implements QuantConnect.Lean.Engine.Setup.ISetupHandler.
Definition at line 98 of file BrokerageSetupHandler.cs.
IBrokerage QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler.CreateBrokerage | ( | AlgorithmNodePacket | algorithmNodePacket, |
IAlgorithm | uninitializedAlgorithm, | ||
out IBrokerageFactory | factory | ||
) |
Creates the brokerage as specified by the job packet
algorithmNodePacket | Job packet |
uninitializedAlgorithm | The algorithm instance before Initialize has been called |
factory | The brokerage factory |
Implements QuantConnect.Lean.Engine.Setup.ISetupHandler.
Definition at line 118 of file BrokerageSetupHandler.cs.
bool QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler.Setup | ( | SetupHandlerParameters | parameters | ) |
Primary entry point to setup a new algorithm
parameters | The parameters object to use |
Implements QuantConnect.Lean.Engine.Setup.ISetupHandler.
Definition at line 145 of file BrokerageSetupHandler.cs.
|
protected |
Loads existing holdings and orders
Definition at line 388 of file BrokerageSetupHandler.cs.
|
protected |
Get the open orders from a brokerage. Adds Orders.Order and Orders.OrderTicket to the transaction handler
algorithm | Algorithm instance |
resultHandler | The configured result handler |
transactionHandler | The configurated transaction handler |
brokerage | Brokerage output instance |
Definition at line 473 of file BrokerageSetupHandler.cs.
void QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler.Dispose | ( | ) |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
<filterpriority>2</filterpriority>
Definition at line 510 of file BrokerageSetupHandler.cs.
|
static |
Max allocation limit configuration variable name
Definition at line 46 of file BrokerageSetupHandler.cs.
|
getset |
The worker thread instance the setup handler should use
Definition at line 51 of file BrokerageSetupHandler.cs.
|
getset |
Any errors from the initialization stored here:
Definition at line 56 of file BrokerageSetupHandler.cs.
|
get |
Get the maximum runtime for this algorithm job.
Definition at line 61 of file BrokerageSetupHandler.cs.
|
get |
Algorithm starting capital for statistics calculations
Definition at line 66 of file BrokerageSetupHandler.cs.
|
get |
Start date for analysis loops to search for data.
Definition at line 71 of file BrokerageSetupHandler.cs.
|
get |
Maximum number of orders for the algorithm run – applicable for backtests only.
Definition at line 76 of file BrokerageSetupHandler.cs.