Architecture & Workflow
How a market idea travels from raw price data to a live order — through a backtest, out-of-sample validation, weeks of paper trading, and a human sign-off — with a risk layer standing guard at every bar. Read each idea twice: once in plain terms, once precisely.
paper-first · Nautilus Trader · IBKR
In plain terms
Cerebro is a robot that tests trading ideas honestly and only lets the survivors touch real money.
It gathers price history, tries a strategy on the past, then re-tests it on data it never "saw" while being tuned. If it still works, it trades a pretend account for a few weeks. Only after a person reviews the results can it go live — and even then, at the smallest size.
Every step has a safety officer that can halt trading if losses get too deep.
Technically
Python strategies run on the Rust-core nautilus_trader engine (CASH account,
NETTING OMS). Bars flow from a ParquetDataCatalog into a Strategy,
through a composed risk layer, to the engine's OMS and out via the IBKR adapter.
Promotion is gated: backtest (in-sample) → walk_forward (OOS) +
param_sensitivity + dsr → IBKR paper → gate_review → live.
Metrics come from a reconstructed net-liquidation curve, never the engine's cash analyzer.
The big picture
Data on the left, market on the right. The strategy never talks to the broker directly — it goes through the risk layer and the engine's order-management system, and the same code path runs in both backtest and live.
How a strategy actually runs
Everything happens on each bar. The order is deliberate: check the kill-switch first, then manage risk, then (maybe) trade. Safety precedes signal.
The promotion pipeline
A strategy may not advance until it passes every criterion at its current stage
(docs/gates.md). A failure sends it back to research — it does not get waved through.
ingest/catalog_check →
backtest/promote_check → walk_forward/param_sensitivity/dsr
→ live/monitor → gate_review.Why so many gates?
Most backtest numbers are lies — a strategy tuned on the past can look brilliant and still be worthless. Each gate is a different way of asking "is this real, or did we fool ourselves?"
What each gate defends against
Gate 1: baseline quality + look-ahead. Gate 2: overfitting (OOS consistency, ±20% param perturbation, deflated Sharpe for N trials). Gate 3: model-vs-reality (fills, slippage, disconnects). Gate 4: the human veto before capital is at risk.
Module map
How the code fits together. Runners orchestrate; strategies decide; the risk package and the equity-curve reconstructor are shared machinery.
backtest.py holds the strategy registry and the
execution model; promote_check.py is the evaluation hub the validation runners share;
every strategy composes the same risk/* components.Explore each stage
Data & Universe
Ingesting survivorship-free price history and point-in-time membership into the Parquet catalog.
Backtest
Assembling a backtest, the no-look-ahead execution model, and honest NLV measurement.
Risk Layer
Position sizing, vol-targeting, exposure caps, and the drawdown kill-switch.
Validation
Walk-forward windows, parameter perturbation, and the deflated Sharpe ratio.
IBKR Paper
The live TradingNode, IBKR/Databento wiring, monitoring, and operational safety.
Review & Live
Divergence analysis, the human sign-off, emergency flatten, and going live at minimum size.
References
Primary sources in the Cerebro repository (paths relative to the repo root).
- CLAUDE.md — project rules: paper-default, Python-only trading path, mandatory stop & risk layer.
- README.md — project intent and the "honest measurement" first principle.
- docs/gates.md — the full Gate 1–4 promotion criteria and automatic rejections.
- docs/runbook.md — operational runbook: start/stop, monitoring, emergency flatten.
- src/ — source root:
strategies/,risk/,runners/,data/,config/.