Skip to content

BacktestResultPacket

QuantConnect.Packets.BacktestResultPacket

BacktestResultPacket()
BacktestResultPacket(json: str)
BacktestResultPacket(
    job: BacktestNodePacket,
    results: BacktestResult,
    end_date: Union[datetime, date],
    start_date: Union[datetime, date],
    progress: float = 1,
)

Bases: Packet

Backtest result packet: send backtest information to GUI for user consumption.

Signature descriptions:

  • Default constructor for JSON Serialization

  • Compose the packet from a JSON string:

  • Compose result data packet - with tradable dates from the backtest job task and the partial result packet.

Parameters:

Name Type Description Default
job Optional[BacktestNodePacket]

Job that started this request

None
results Optional[BacktestResult]

Results class for the Backtest job

None
end_date Optional[Union[datetime, date]]

The algorithms backtest end date

None
start_date Optional[Union[datetime, date]]

The algorithms backtest start date

None
progress Optional[float]

Progress of the packet. For the packet we assume progess of 100%.

1

user_id

user_id: int

User Id placing this task

project_id

project_id: int

Project Id of the this task.

session_id

session_id: str

User Session Id

backtest_id

backtest_id: str

BacktestId for this result packet

optimization_id

optimization_id: str

OptimizationId for this result packet if any

compile_id

compile_id: str

Compile Id for the algorithm which generated this result packet.

period_start

period_start: datetime

Start of the backtest period as defined in Initialize() method.

period_finish

period_finish: datetime

End of the backtest period as defined in the Initialize() method.

date_requested

date_requested: datetime

DateTime (EST) the user requested this backtest.

date_finished

date_finished: datetime

DateTime (EST) when the backtest was completed.

progress

progress: float

Progress of the backtest as a percentage from 0-1 based on the days lapsed from start-finish.

name

name: str

Name of this backtest.

results

results: BacktestResult

Result data object for this backtest

processing_time

processing_time: float

Processing time of the algorithm (from moment the algorithm arrived on the algorithm node)

tradeable_dates

tradeable_dates: int

Estimated number of tradeable days in the backtest based on the start and end date or the backtest

type

type: PacketType

Packet type defined by a string enum

channel

channel: str

User unique specific channel endpoint to send the packets

create_empty

create_empty(
    job: BacktestNodePacket,
) -> BacktestResultPacket

Creates an empty result packet, useful when the algorithm fails to initialize

Parameters:

Name Type Description Default
job BacktestNodePacket

The associated job packet

required

Returns:

Type Description
BacktestResultPacket

An empty result packet.