Skip to content

ResultsAnalyzer

QuantConnect.Lean.Engine.Results.Analysis.ResultsAnalyzer

ResultsAnalyzer(
    result: Result,
    algorithm: QCAlgorithm,
    language: Language,
    logs: Sequence[str],
)

Bases: Object

Runs the full suite of backtest diagnostic tests against a single backtest.

Initializes a new instance of the ResultsAnalyzer class.

Parameters:

Name Type Description Default
result Result

The backtest result to analyze.

required
algorithm QCAlgorithm

The algorithm instance used for history requests and settings.

required
language Language

The programming language the algorithm is written in.

required
logs Sequence[str]

The full list of log lines produced by the backtest.

required

run

run(
    time_limit_seconds: int = 5,
    max_failed_analyses: int = 10,
) -> Sequence[Analysis]

Runs all registered diagnostic checks against the backtest in weight order, stopping early when the time limit or maximum failure count is reached.

Parameters:

Name Type Description Default
time_limit_seconds int

Wall-clock seconds allowed for the full chain before early exit.

5
max_failed_analyses int

Maximum number of failing analyses to collect before stopping; also the max returned.

10

Returns:

Type Description
Sequence[Analysis]

Up to max_failed_analysesQuantConnect.Analysis entries with solutions, ranked by weight.