Architecture
Market Data Stream
The consolidated perps book is a two-second snapshot of public Bybit, Binance and OKX tickers. Humans read it free. An agent can buy one copy of the same book for a tenth of a cent, subject to the x402 rail.
This is not a colocated feed
Endpoints
| Parameter | Type | Description |
|---|---|---|
| GET /api/markets/streamrequired | SSE | Public. 20 connections per minute per IP. Tick frames carry the snapshot. The function closes after about 50 seconds; EventSource reconnects. |
| GET /api/markets/perps/consolidatedrequired | JSON | Public one-shot snapshot, 60 per minute per IP. Shape is { ok, data } with rows, venue health and generatedAt. |
| GET /api/x402/market-dataoptional | 402 | Optional symbols list, capped at the registry. Quotes $0.001 before any payment is checked. Unknown symbols are refused with 400 and are not quoted. |
How a row is built
Best bid is the highest positive bid across venues that returned a two-sided quote. Best ask is the lowest ask. Spread is (ask − bid) / mid × 10,000 basis points, and it may be negative when the global book is crossed. A symbol with only one side is dropped.
- Prices that are not finite, not positive, or above 1e12 are discarded.
- An empty string from a venue is null, never a fabricated zero.
- If one venue throws, the other two still publish.
Crossed books and snapshot skew
Each venue snapshot is cached for up to ten seconds, so the two winning quotes on a row can have been observed seconds apart. A negative spread across that gap is usually a market moving between the polls, not an arbitrage anyone can trade. A row therefore shows the crossed badge only when both winning venue snapshots carry timestamps within CROSS_SKEW_TOLERANCE_MS (5 seconds) of each other — the spreadSkewMs() gap, mirrored in the extension client. Outside that window the spread renders muted as skew-suspect, with the measured gap in its tooltip.
Clients
The markets page holds one SharedWorker per browser so extra tabs share a single event stream, and falls back to a page EventSource where shared workers are missing. The Chrome extension paints from the REST snapshot, then listens only while the popup is open.
Open the panel at /markets. The reference optical worksheet lives at /infrastructure.
Paying for a snapshot
An unpaid GET /api/x402/market-data returns 402 with the same challenge shape as the FX route, or 503 when the quote secret or the x402 rail is not configured. A paid response includes the per-venue block. Check GET /api/rails before treating a challenge as something an agent can settle.
