Polytraders Dev Guide
internal
v3 spine Phase 1 · Shared contracts 9 demo-wired · 0 shadow-ready · 0 production-live · 100 pending · 109 total 15/33 infra tasks the plan status board
platform · 11 stages

The Polytraders operating loop, stage by stage.

Every trade passes through the same eleven stages. Each stage has a single responsibility, a clear backend surface, and a reference TypeScript implementation in packages/polytraders-*. The platform mock at /mock-app/ shows what each stage looks like in operation; these dev pages show how to code each one.

Shared operating rule: net_edge = p_hat − q_exec − fees − uncertainty_buffer. No stage may skip the one before it — that is what makes a trade explainable and safe enough to scale.

Stage 1

Market registry and instrument truth

Without a clean registry there is no shared notion of "the market". Every downstream stage reads from this one source.

7 backend fields · 3 formulas · 4 mock pages
Stage 2

Ingestion and order-book reconstruction

Turn the live websocket / REST feed into a continuously valid order book, or refuse to trade against it.

6 backend fields · 3 formulas · 3 mock pages
Stage 3

Canonical state and the event log

Every stage agrees on the same facts because they all read from one append-only event log.

6 backend fields · 3 formulas · 2 mock pages
Stage 4

Signal engine

Measure market state. Never decide whether to trade.

6 backend fields · 4 formulas · 2 mock pages
Stage 5

Fair-value engine

Turn the shared feature vector into a calibrated probability and a sensible uncertainty band.

6 backend fields · 3 formulas · 2 mock pages
Stage 6

Execution estimate

Before placing an order, predict the price you would actually fill at — and the probability you will get filled at all.

7 backend fields · 3 formulas · 2 mock pages
Stage 7

Decision, risk, and sizing

The single gate that turns a forecast into an approved trade. No stage downstream may bypass it.

7 backend fields · 4 formulas · 4 mock pages
Stage 8

Order manager and reconciliation

Live trading fails at the edges — retries, missed cancels, duplicate acks. The OMS keeps local state aligned with the exchange.

7 backend fields · 3 formulas · 5 mock pages
Stage 9

Inventory, settlement, and accounting

Turn raw fills into a clean capital ledger — free, reserved, redeemable, realised.

6 backend fields · 4 formulas · 4 mock pages
Stage 10

Replay, backtesting, and validation

The platform becomes trustworthy when the same raw inputs recreate the same state, the same decisions, and the same simulated fills.

7 backend fields · 4 formulas · 3 mock pages
Stage 11

Monitoring, incident response, and rollout

A first-class system fails safely, explains itself clearly, and improves after each incident.

7 backend fields · 3 formulas · 5 mock pages
Recap

One trade, traced end to end

The shared language: one market, one set of artefacts, one explainable trade path from raw data to final outcome.

shared operating rule · net_edge = p_hat − q_exec − fees − buffer