BaseSetupHandler
QuantConnect.Lean.Engine.Setup.BaseSetupHandler
Bases: Object
Base class that provides shared code for the ISetupHandler implementations
INITIALIZATION_TIMEOUT
INITIALIZATION_TIMEOUT: timedelta
Get the maximum time that the initialization of an algorithm can take
ALGORITHM_CREATION_TIMEOUT
ALGORITHM_CREATION_TIMEOUT: timedelta
Get the maximum time that the creation of an algorithm can take
get_configured_data_feeds
get_configured_data_feeds() -> (
Dictionary[SecurityType, List[TickType]]
)
Get the available data feeds from config.json,
initialize_debugging
initialize_debugging(
algorithm_node_packet: AlgorithmNodePacket,
worker_thread: WorkerThread,
) -> bool
Initialize the debugger
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm_node_packet
|
AlgorithmNodePacket
|
The algorithm node packet |
required |
worker_thread
|
WorkerThread
|
The worker thread instance to use |
required |
load_backtest_job_account_currency
load_backtest_job_account_currency(
algorithm: IAlgorithm, job: BacktestNodePacket
) -> None
Sets the account currency the algorithm should use if set in the job packet
load_backtest_job_cash_amount
load_backtest_job_cash_amount(
algorithm: IAlgorithm, job: BacktestNodePacket
) -> None
Sets the initial cash for the algorithm if set in the job packet.
set_brokerage_trading_day_per_year
set_brokerage_trading_day_per_year(
algorithm: IAlgorithm,
) -> None
Set the number of trading days per year based on the specified brokerage model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm
|
IAlgorithm
|
The algorithm instance |
required |
Returns:
| Type | Description |
|---|---|
None
|
The number of trading days per year. For specific brokerages (Coinbase, Binance, Bitfinex, Bybit, FTX, Kraken), the value is 365. For other brokerages, the default value is 252. |
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. |
setup_currency_conversions
setup_currency_conversions(
algorithm: IAlgorithm,
universe_selection: UniverseSelection,
currencies_to_update_white_list: Sequence[str] = None,
) -> None
Will first check and add all the required conversion rate securities and later will seed an initial value to them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm
|
IAlgorithm
|
The algorithm instance |
required |
universe_selection
|
UniverseSelection
|
The universe selection instance |
required |
currencies_to_update_white_list
|
Sequence[str]
|
If passed, the currencies in the CashBook that are contained in this list will be updated. By default, if not passed (null), all currencies in the cashbook without a properly set up currency conversion will be updated. This is not intended for actual algorithms but for tests or for this method to be used as a helper. |
None
|