OptimizationBacktestMetrics
QuantConnect.Optimizer.OptimizationBacktestMetrics
Bases: BacktestSummary
Lightweight per-backtest record extracted at LeanOptimizer time to avoid retaining the full backtest JSON.
total_performance
total_performance: AlgorithmPerformance
The backtest's total performance (wraps QuantConnect.Statistics.TradeStatistics, QuantConnect.Statistics.PortfolioStatistics, and QuantConnect.Statistics.Trade list); null when absent from the backtest result.
total_orders
total_orders: int
Number of orders the backtest produced.
analysis_names
analysis_names: Sequence[str]
Names of the diagnostic QuantConnect.Analysis entries the backtest attached.
backtest_id
backtest_id: str
The backtest id; kept for programmatic access but not serialized into the analysis JSON.
parameters
parameters: Dict[str, float]
Parameter values the backtest was run with.
sharpe_ratio
sharpe_ratio: float
The backtest's Sharpe ratio.
extract_from
extract_from(
backtest_id: str,
parameter_set: ParameterSet,
json_backtest_result: str,
) -> OptimizationBacktestMetrics
Extracts the fields the analyzer needs from a backtest result JSON; returns null when the parameter set is invalid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backtest_id
|
str
|
The backtest id. |
required |
parameter_set
|
ParameterSet
|
The parameter set the backtest was run with. |
required |
json_backtest_result
|
str
|
The serialized backtest result JSON. |
required |