Operator Safety
The safety snapshot is read-only. It exists to keep the operator’s view of the account consistent across
/status, /safety, /positions, the hourly report, and the audit command.
Scan-cycle reconciliation uses that snapshot separately to heal confirmed-flat and orphan state; it does not place broker orders.
Commands
| Command | What it shows |
|---|---|
/safety | Open positions, total live P&L, per-strategy live P&L, portfolio Greeks, Greek limit status, kill switch, and balance state. |
/broker_health | Latest Dhan token, market feed, option-chain, order, position, and margin API health with the current trading-mode downgrade. |
/envelope | Risk envelope status, pause reason/until, drawdown counters, and loss-streak count. |
/resume_envelope confirm | Clears an envelope pause and resets the loss-streak counter after operator review. |
/status | Bot state plus embedded safety summary. |
/positions | Each open trade, its strategy tag, and the aggregate live P&L total. DC, DCS, and DCS_SKEW include live Greeks when LTP and spot data are available. |
/risk | Strategy-specific risk view for DC, DCS, DCS_SKEW, DDC, IC, and AI_MARKET. |
/explain_signal | Latest pass/fail reason for dc, dcs, dcs_skew/sdcs, ddc, or ic. |
/audit_positions | Read-only broker-vs-tracker mismatch report. |
/confirm_recon <tag> | Acknowledge a pending quantity mismatch and unblock new entries for that strategy. |
/golive_status | DRY_RUN / SHADOW / LIVE state plus current confidence summary for each strategy. |
/confidence_report <strategy> | 15-trading-day win-rate breakdown used by the shadow gate. |
/ai_promotion_report | AI_MARKET promotion-readiness report: verdict history, confidence-band performance, forecast score, AI cost, DDC with-AI comparison, and error log. |
/shadow, /promote, /revert | Operator-controlled go-live transitions. |
| Dashboard Go-Live panel | Browser view of each strategy state, confidence sample, and required margin via /api/go-live/status. |
| Dashboard AI Market promotion report | Browser view of the same AI_MARKET promotion gate via /api/ai-market/promotion-report. |
| Dashboard Portfolio Greeks panel | Browser view of total Greeks, configured limits, breach status, and strategy-wise contribution via /api/safety/portfolio-greeks. |
| Dashboard Broker Health API | Browser/API view of latest and recent persisted broker health samples via /api/broker/health. |
| Dashboard Risk Envelope panel | Browser view of envelope status, caps, and loss streak via /api/envelope/state. |
| Dashboard Reconciliation Log | Inline audit table for auto-removals, orphan adoptions, mismatch confirmations, and orphan alerts via /api/reconciliation/log. |
Alert Vocabulary
| Reason | Trigger |
|---|---|
low_balance | Balance check fails or preflight keeps trading paused. |
position_drift | Tracked flat legs, quantity mismatches, or broker orphans appear. |
stale_trade | An open trade stays active longer than the stale window. |
duplicate_trade | Two open trades share the same tag and need operator review. |
| Exact-leg entry rejection | A new DC-family candidate has incomplete/malformed option security IDs or exactly matches the complete option-leg set of an open position. Entry fails closed before simulation or broker orders. |
| MDC scale-in rejection | The newest remaining MDC anchor has insufficient elapsed time/movement, is not OPEN, lacks live P&L/risk data, or is at/below the −10% anchor-loss limit. |
broker_orphan | Broker position exists but is not tracked locally. |
go_live_margin_block | SHADOW/LIVE entry skipped because available balance is below strategy max margin plus 10% buffer. |
portfolio_greeks_block | SHADOW/LIVE entry skipped because candidate Greeks would breach portfolio limits. |
portfolio_greeks_would_block | Dry-run entry would breach portfolio limits but is allowed because PORTFOLIO_BLOCK_DRY_RUN is false. |
broker_health_degraded | Broker health is DEGRADED, UNSTABLE, or DOWN; live-capital entries are downgraded or blocked. |
risk_envelope_paused | Risk envelope is PAUSED or HALTED; existing positions are still monitored, but new scanner entries are skipped. |
Broker Health Guard
BrokerHealthMonitor records a read-only health sample each scan cycle in broker_health_samples.
It checks token presence, market-feed LTP, expiry/option-chain access, order-list access, position API access, and fund-limits access.
The aggregate status controls new entries before strategy scanners run:
| Status | Runtime effect |
|---|---|
HEALTHY | Normal DRY_RUN/SHADOW/LIVE go-live state applies. |
DEGRADED | New entries are allowed only as dry-run simulations. |
UNSTABLE | New entries are allowed only as dry-run simulations until health recovers. |
DOWN | New entry scans are skipped after monitoring and reconciliation complete. |
What The Snapshot Shows
open_count ← number of currently open trades
live_pnl_total ← total unrealised P&L across open trades
by_strategy.DC ← DC count + live P&L
by_strategy.DCS ← DCS count + live P&L
by_strategy.DCS_SKEW ← skew-aware DCS count + live P&L
by_strategy.DDC ← directional diagonal count + live P&L
by_strategy.IC ← iron condor count + live P&L
by_strategy.AI_MARKET ← AI dry-run option count + live valuation when LTP is available
portfolio_greeks.totals ← aggregate Δ/Γ/Θ/ν across open trades with stored Greek data
portfolio_greeks.by_strategy ← strategy-wise Greek contribution
portfolio_greeks.breaches ← configured limit breaches, if any
kill_switch ← active or OK
low_balance ← low balance or OK
Operational rule
If the safety summary and the broker audit disagree, trust the broker audit first and inspect the trade state before taking action.
Never use
/confirm_recon to ignore a live quantity mismatch unless the broker position has been reviewed.