Skip to content

NonTradableSecurityOrderResponseErrorAnalysis

QuantConnect.Lean.Engine.Results.Analysis.Analyses.NonTradableSecurityOrderResponseErrorAnalysis

Bases: MessageAnalysis

Detects orders placed for non-tradable securities.

issue

issue: str

Gets a description of the non-tradable security ordering issue.

weight

weight: int

Gets the priority weight for this analysis.

expected_message_text

expected_message_text: List[str]

Gets the message fragments that identify a non-tradable security error.

This Property is protected.

runs_in_run

runs_in_run: bool

Whether this analysis can also run while the backtest is still in progress, against a snapshot of the intermediate results. Most analyses read only the result snapshot, so this defaults to true. Analyses that need the completed run (runtime errors, equity curves, final statistics, completion logs) or that read algorithm state that is not safe to access while it runs override this to leave them to the final analysis only.

is_state_based

is_state_based: bool

Whether this analysis reads the current backtest state (statistics, orders, charts) instead of scanning the append-only order event and log streams. When run in-run, it runs against the full current state on every run and its findings replace the previous ones instead of accumulating.

expected_message_pattern

expected_message_pattern: Regex

Optional regex that identifies the issue message, taking precedence over expected_message_text. Use it for messages with variable parts fragments cannot pin down, like method names formatted by algorithm language.

This Property is protected.

solutions

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

Gets solutions for checking the IsTradable flag before placing orders.

This Class 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 Class 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 Class 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 pattern or text fragments and returns results with solutions when matches are found.

match

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

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

This Class is protected.