Skip to content

CrisisEventsAnalysis

QuantConnect.Lean.Engine.Results.Analysis.Analyses.CrisisEventsAnalysis

Bases: BaseResultsAnalysis

Compares the strategy's Sharpe ratio to the benchmark's across known crisis / market-stress periods. Source: https://github.com/QuantConnect/Lean/blob/master/Report/Crisis.cs

issue

issue: str

Gets the description indicating that the strategy underperformed the benchmark during crisis events.

weight

weight: int

Gets the severity weight for crisis event underperformance analysis.

run

run(
    parameters: ResultsAnalysisRunParameters,
) -> Sequence[Analysis]
run(
    algorithm: QCAlgorithm,
    backtest_equity: SortedList[datetime, float],
    benchmark_equity: SortedList[datetime, float],
) -> Sequence[Analysis]

Signature descriptions:

  • Runs the crisis events analysis against the provided backtest parameters.

  • Compares the strategy's Sharpe ratio to the benchmark's across all crisis events that fall entirely within the backtest period.

Parameters:

Name Type Description Default
algorithm Optional[QCAlgorithm]

The algorithm instance used to obtain the risk-free rate model.

None
backtest_equity Optional[SortedList[datetime, float]]

Daily equity values for the strategy, keyed by date.

None
benchmark_equity Optional[SortedList[datetime, float]]

Daily equity values for the benchmark (SPY), keyed by date.

None

Returns:

Type Description
Sequence[Analysis]

Analysis results listing crisis periods where the strategy underperformed the benchmark.

single_response

single_response(
    sample: Any, solutions: Sequence[str] = None
) -> Sequence[Analysis]
single_response(
    sample: Any,
    count: Optional[int],
    solutions: Sequence[str] = None,
) -> Sequence[Analysis]

Wraps a single QuantConnect.Analysis in a one-element read-only list.

create_aggregated_response

create_aggregated_response(
    responses: List[Analysis],
) -> Sequence[Analysis]

Filters responses to those with solutions, prefixes the class name, and returns a flat list.

This codeEntityType is protected.

format_code

format_code(code: str, language: Language) -> str

Formats the specified code string according to the conventions of the given programming language.

This codeEntityType is protected.