Review & go live
Code never promotes itself to live. It produces the evidence — a divergence analysis of paper versus backtest — and a checklist. A human reads it, signs off, and only then does the strategy trade real capital, at the smallest viable size.
In plain terms
Before risking real money, Cerebro compares the paper results to what the backtest promised. If they diverge in an important way, it flags it. A person must review and approve — the software cannot flip the switch itself.
Technically
gate_review.py loads a paper-session record, runs a backtest baseline, and
compute_divergence() compares Sharpe, drawdown, win-rate, slippage, and fill-rate. It
writes a git-tracked, unchecked review doc to docs/reviews/. No code path approves live.
The Gate 4 review
Paper meets backtest one last time. Material divergence on any comparable metric is flagged for investigation; the output is a review document with an unchecked six-item checklist and a blank sign-off block for a human.
| Gate 4 checklist (human) |
|---|
| Paper results reviewed by a human |
| Material divergence from backtest investigated & explained |
| Position sizing set to minimum viable (1× or fractional) |
| Emergency flatten command tested |
| IP-restricted API keys configured |
| Separate state store from the paper environment |
Emergency flatten
At any stage, one command cancels every order and closes every position, on a separate client ID so it can run alongside — or instead of — the main node. It confirms the book is actually flat, or fails loudly.
client_id = 2, and exits non-zero if
it can't confirm a flat book within the 60-second deadline — so an operator (or a script) knows the true outcome.$ python -m src.runners.gate_review --strategy cross_sectional_momentum --sample wrote docs/reviews/gate4_review_cross_sectional_momentum_2026-01-01.md $ python -m src.runners.flatten # cancel all orders + close all positions
Live starts at minimum size, with IP-restricted keys and a state store separate from paper. Position sizing, the kill-switch, and the flatten command all carry over unchanged — the safety layer that ran in every backtest is the same one now standing between the strategy and real capital.
References
- src/runners/gate_review.py —
compute_divergence,check_gate4_divergence,generate_review_markdown,GATE4_CHECKLIST. - src/runners/flatten.py —
FlattenStrategy,DEADLINE_SECONDS, client-id-2 isolation, paper-mode guard. - docs/gates.md — Gate 4 checklist and the automatic-rejection rules.
- docs/runbook.md — emergency flatten, graceful shutdown, weekly review.