Skip to content

MarginCallsAnalysis

QuantConnect.Lean.Engine.Results.Analysis.Analyses.MarginCallsAnalysis

Bases: MessageAnalysis

Detects margin-call events in the backtest logs.

issue

issue: str

Description of the margin-call issue detected by this analysis.

weight

weight: int

Relative weight indicating the severity of margin-call events.

expected_message_text

expected_message_text: List[str]

Log messages indicating that a margin-call order was executed.

This codeEntityType is protected.

solutions

solutions(language: Language) -> List[str]

Returns suggested solutions for preventing or handling margin calls.

This codeEntityType is protected.

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.

run

run(
    parameters: ResultsAnalysisRunParameters,
) -> Sequence[Analysis]
run(
    messages: Sequence[str], language: Language
) -> Sequence[Analysis]

Runs the analysis by scanning messages for the expected text fragments and returns results with solutions when matches are found.

match

match(
    messages: Sequence[str], expected_messages: List[str]
) -> Iterable[str]

Returns messages from messages that contain all strings in expected_messages (case-insensitive).

This codeEntityType is protected.