Skip to content

BacktestNodePacket

QuantConnect.Packets.BacktestNodePacket

BacktestNodePacket()
BacktestNodePacket(
    user_id: int,
    project_id: int,
    session_id: str,
    algorithm_data: List[int],
    starting_capital: float,
    name: str,
)
BacktestNodePacket(
    user_id: int,
    project_id: int,
    session_id: str,
    algorithm_data: List[int],
    name: str,
    starting_capital: Optional[CashAmount] = None,
)

Bases: AlgorithmNodePacket

Algorithm backtest task information packet.

Signature descriptions:

  • Default constructor for JSON

  • Initialize the backtest task packet.

name

name: str

Name of the backtest as randomly defined in the IDE.

backtest_id

backtest_id: str

BacktestId / Algorithm Id for this task

optimization_id

optimization_id: str

Optimization Id for this task

period_start

period_start: Optional[datetime]

Backtest start-date as defined in the Initialize() method.

period_finish

period_finish: Optional[datetime]

Backtest end date as defined in the Initialize() method.

out_of_sample_max_end_date

out_of_sample_max_end_date: Optional[datetime]

Backtest maximum end date

out_of_sample_days

out_of_sample_days: int

The backtest out of sample day count

tradeable_dates

tradeable_dates: int

Estimated number of trading days in this backtest task based on the start-end dates.

debugging

debugging: bool

True, if this is a debugging backtest

cash_amount

cash_amount: Optional[CashAmount]

Optional initial cash amount if set

algorithm_mode

algorithm_mode: AlgorithmMode

Algorithm running mode.

type

type: PacketType

Packet type defined by a string enum

channel

channel: str

User unique specific channel endpoint to send the packets

python_virtual_environment

python_virtual_environment: str

Virtual environment ID used to find PythonEvironments Ideally MD5, but environment names work as well.

host_name

host_name: str

The host name to use if any

user_id

user_id: int

User Id placing request

user_token

user_token: str

organization_id

organization_id: str

project_id

project_id: int

Project Id of the request

project_name

project_name: str

Project name of the request

algorithm_id

algorithm_id: str

Algorithm Id - BacktestId or DeployId - Common Id property between packets.

session_id

session_id: str

User session Id for authentication

language

language: Language

Language flag: Currently represents IL code or Dynamic Scripted Types.

server_type

server_type: ServerType

Server type for the deployment (512, 1024, 2048)

compile_id

compile_id: str

Unique compile id of this backtest

version

version: str

Version number identifier for the lean engine.

redelivered

redelivered: bool

An algorithm packet which has already been run and is being redelivered on this node. In this event we don't want to relaunch the task as it may result in unexpected behaviour for user.

algorithm

algorithm: List[int]

Algorithm binary with zip of contents

request_source

request_source: str

Request source - Web IDE or API - for controling result handler behaviour

ram_allocation

ram_allocation: int

The maximum amount of RAM (in MB) this algorithm is allowed to utilize

controls

controls: Controls

Specifies values to control algorithm limits

parameters

parameters: Dictionary[str, str]

The parameter values used to set algorithm parameters

history_provider

history_provider: str

String name of the HistoryProvider we're running with

deployment_target

deployment_target: DeploymentTarget

Deployment target, either local or cloud.

get_algorithm_name

get_algorithm_name() -> str

Gets a unique name for the algorithm defined by this packet