Risk gates¶
Portfolio-level risk limits you can check each bar.
Start with the topic guide for worked examples. Signatures below show the available arguments.
daily_loss_limit(pct: float) -> bool¶
pct is a positive finite percent number: 2.0 means 2%. Compares current equity with the first-observed UTC daily baseline, shared across the strategy's instruments and retained by Engine checkpoints. Naive timestamps mean UTC. It does not latch, close positions or cancel orders. Missing required observations can return false. See risk checks.
max_consecutive_losses(n: int) -> bool¶
n is a positive count of consecutive negative realised closed-trade records. Returns false if records or P&L are unavailable, or if a zero-profit/winning trade breaks the streak. This check does not place orders.
traded_today(symbol: Optional[str] = None) -> bool¶
Checks whether the selected/current instrument has an observed entry on the current bar's date, including recorded closed trades. It needs position-entry tracking; it is a predicate rather than an instruction to limit trading. Date boundaries use the supplied timestamps.