Gate checks (entry orders)
| Check | Failing condition |
|---|---|
| Min balance | balance_cents < min_balance_cents |
| Single-order cap | order_cost_cents > max_single_order_cents |
| Total exposure | (current_exposure + order_cost) > max_total_exposure_cents |
| Daily loss cap | |daily_realized_pnl| > max_daily_loss_cents (if PnL is negative) |
| Position count | open_positions >= max_positions |
| Orders this tick | orders_this_tick >= max_orders_per_tick |
| Cooldown after loss | ticks_since_last_loss < cooldown_after_loss_ticks |
Gate checks (exit orders)
Exit orders skip the position-count and exposure gates (they reduce exposure), but still respect single-order cap and daily-loss cap.Configuration
Per-user limits live inportfolio_config. Update with:
Drawdown halt
Two thresholds beyond per-trade gates:drawdown_warn_cents(default $300) — emits ahealth_alertbut doesn’t halt.max_drawdown_halt_cents(default $500) — auto-flipsexecution_modetohalted. Recoverable only by manualsf portfolio config executionMode live.
Where gates apply
The same gate semantics apply across the CLI agent, web terminal trade ticket, intent executor, and portfolio autopilot. Treat the gate result as the contract: accepted orders proceed, rejected orders return a structured reason.Next steps
Portfolio autopilot
The autopilot runtime calling these gates.
Trade intents
Gate also runs on intent submission.