End-to-end lag
| Symbol | Meaning | Units / range |
|---|---|---|
| \(source_ts\) | Time the venue produced the update | ms epoch |
| \(proc_ts\) | Time the canonical envelope was sealed | ms epoch |
Stage 11 alerts when p99 lag breaches the SLO (default 250 ms).
← All stages · stage 3 of 11
Every stage agrees on the same facts because they all read from one append-only event log.
If signals see one book and execution sees another, you cannot replay or explain a trade. Different stages must observe the same state at the same logical time.
Wraps each ingestion output in a typed canonical event with monotonic event_id, source_ref, correlation_id, source/recv/proc timestamps, and a content hash. Appends it to the event log.
The event log is what makes replay possible. It is the audit trail and the input to every backtest.
Every formula below is implemented in packages/polytraders-bots/ or packages/polytraders-runner/. Treat the worked example as the unit-test sanity check you should be able to reproduce locally.
| Symbol | Meaning | Units / range |
|---|---|---|
| \(source_ts\) | Time the venue produced the update | ms epoch |
| \(proc_ts\) | Time the canonical envelope was sealed | ms epoch |
Stage 11 alerts when p99 lag breaches the SLO (default 250 ms).
| Symbol | Meaning | Units / range |
|---|---|---|
| \(state\) | Normalised order-book state at this event | struct |
| \(book_hash\) | Hex digest carried on the canonical envelope | 32 bytes |
Stage 10 replays the event log and recomputes hashes — divergence means a non-deterministic dependency leaked in.
| Symbol | Meaning | Units / range |
|---|---|---|
| \(event_id\) | 64-bit monotonic counter per pipeline | uint64 |
Out-of-order events are dropped — the canonical log is the audit trail; it must not lie about ordering.
Reference TypeScript implementation lives in packages/polytraders-* at the repository root. Stage owners maintain these files — read them before writing new code.
packages/polytraders-contracts/src/MarketSnapshot.tsCanonical types used everywhere. Stage 3 is responsible for filling every field, not just the cheap ones.packages/polytraders-runner/src/context.jsBotContext — the way every bot reads canonical state. Bots never read raw feeds; they read context.packages/polytraders-mock-clob-v2/src/envelopes.jsReference envelope writer; demonstrates correlation_id propagation through a trade.The platform mock is the source of truth for what each stage's UI exposes. Open these alongside the code references.
INTEL_*INTEL — ingest, freshness, signalsGOV_*GOV — governance, accounting, replay, monitoringHover or tap any reason code on this page (or anywhere on the site) to see its canonical short description. Full registry: /standards/reason-codes.