Archived
Every live market is subscribed on two connections chosen at random, and its book takes each change from whichever connection delivers it first: the book hash says whether a change is a duplicate, the next one, or one to hold until the change before it arrives. A change one connection misses costs nothing, each Delta carries the earliest receive time, and a connection that drops is covered by the other. When a change fits on no connection in time, the book follows one connection unchecked and asks the other for a fresh book. Connections now decode and route events to 16 book threads, independent of them; a move leaves its old connection only once the new one delivers, so it costs no change; a connection closed with 1013 twice within ten minutes is split. reconcile reads the collector's log and fails only on a mismatch no cause line explains. SIGTERM and SIGHUP stop the collector cleanly. Breaking: lanes are gone (connections and book threads are separate), and reconcile takes the log as a second argument.
Test fixtures
Two recordings of Polymarket's market channel, replayed by the tests in
src/polymarket/feed.rs (the first also by socket.rs's routing test), and
Gamma pages read by src/polymarket/gamma.rs (no network in tests).
gamma-markets.json: Gamma's top 20 markets by 24 h volume on 2026-11-04, trimmed to the fields the collector reads.conditionId,active,closedandacceptingOrderswere added in sprint 03 (the ids from the recorded books'market).gamma-created.json,gamma-closed.json: one/markets/keysetpage each (limit=10) of the newest live markets bycreatedAtand the latest closed byclosedTime, 2026-11-04 ~17:00 UTC, trimmed the same way.polymarket-frames.jsonl: the first 90 s (14:24:44 to 14:26:14 UTC, so two minute boundaries) of the market channel for those markets' 40 tokens, one line per frame:{"received_at_us": <receive time, µs>, "text": <frame>}. Opening books, 3,850 changes, 28 mid-stream books, 14 trades, 8PONGs.polymarket-frames-two.jsonl: 95 s (2026-11-11, 12:19:58 to 12:21:33 UTC) of the same tokens on two connections at once, in receive order, each line with itsconnection(0 or 1). 20 of the 40 tokens still had an order book.record.py: the recorder, if the fixtures need redoing, on CONNECTIONS connections at once (default 1):uvx --with websockets python -I record.py gamma-markets.json frames.jsonl 90 [CONNECTIONS].