pub struct Risk {Show 18 fields
pub account_value: Option<f64>,
pub drawdown_pct: Option<f64>,
pub daily_pnl_usd: Option<f64>,
pub daily_loss_usd: Option<f64>,
pub peak_equity: Option<f64>,
pub peak_equity_30d: Option<f64>,
pub open_count: Option<u32>,
pub halted: bool,
pub global_halt: bool,
pub stop_failure_halt: bool,
pub capital_floor_hit: bool,
pub halt_reason: Option<String>,
pub halt_until: Option<String>,
pub updated_at: Option<String>,
pub daily_loss_since: Option<String>,
pub last_drawdown_alert_pct: Option<f64>,
pub per_runner: BTreeMap<String, Value>,
pub extra: BTreeMap<String, Value>,
}Expand description
GET /risk summary. Field names mirror the engine’s real wire
shape (see engine/zero/api.py::get_risk and the risk.json
fixture captured under tests/fixtures/).
Historical note: older mock fixtures used daily_loss_pct,
exposure_pct, kill_all, circuit_breaker_active,
concurrent_positions, and max_concurrent. The live engine
emits none of those; they were removed to stop the CLI from
silently rendering — for fields that never existed. Current
render code derives percentages from dollar amounts where
necessary (see Risk::daily_loss_pct, Risk::drawdown_pct).
Fields§
§account_value: Option<f64>§drawdown_pct: Option<f64>§daily_pnl_usd: Option<f64>§daily_loss_usd: Option<f64>§peak_equity: Option<f64>§peak_equity_30d: Option<f64>§open_count: Option<u32>§halted: bool§global_halt: bool§stop_failure_halt: bool§capital_floor_hit: bool§halt_reason: Option<String>§halt_until: Option<String>§updated_at: Option<String>§daily_loss_since: Option<String>§last_drawdown_alert_pct: Option<f64>§per_runner: BTreeMap<String, Value>§extra: BTreeMap<String, Value>Implementations§
Source§impl Risk
impl Risk
Sourcepub fn is_halted(&self) -> bool
pub fn is_halted(&self) -> bool
True when the engine has stopped accepting new risk, for any
reason the wire format exposes. The engine currently sets a
single halted bool plus a pair of more-specific flags; any
of them should land the operator on an alert line.
Sourcepub fn daily_loss_pct(&self) -> Option<f64>
pub fn daily_loss_pct(&self) -> Option<f64>
Daily loss as a percent of peak equity, derived from the
two dollar fields the engine publishes. Returns None if
peak equity is missing or zero so callers can render —
rather than a bogus zero.