Read-only harness that measures how far Polymarket’s order book lags the true BTC price. Built to size the Binance→Polymarket latency-arbitrage opportunity described in short-term-accuracy. Places no orders — market-data websockets only.
what it is
New Rust crate crates/lag-probe in the polymarket_fetch workspace.
cargo run --release -p lag-probe -- --duration <secs> # live capture
cargo run --release -p lag-probe -- --analyze <file>.jsonl # re-analyze a saved capture
It captures four feeds, locally timestamps every event (monotonic + wall clock), logs to JSONL, and computes a lag distribution via a directional event-study plus a first-differences cross-correlation.
the four feeds
| Feed | Source | Rate |
|---|---|---|
| DirectBinance | wss://stream.binance.com:9443/ws/btcusdt@bookTicker | event-driven, fast (~9000 events / 3 min) — the fast reference |
| RtdsBinance | Polymarket RTDS wss://ws-live-data.polymarket.com, topic crypto_prices | ~1 Hz republished |
| RtdsChainlink | Polymarket RTDS, topic crypto_prices_chainlink | ~1 Hz republished |
| ClobBook | Polymarket CLOB market-data WS, order book for the active btc-updown market | event-driven |
API gotchas
RTDS subscribe —
filtersmust be object/array-shapedThe RTDS
filtersfield must be a JSON-object/array-shaped string, not a bare word. A bare"filters":"btcusdt"makes RTDS reject the WHOLE subscription with HTTP 400. Fix: subscribe tocrypto_pricesandcrypto_prices_chainlinkwith nofilters, then filter the symbol (btcusdt/btc/usd) client-side.
Finding the active btc-updown market — compute the slug, don't page Gamma
Do not page Gamma’s
closed=falselist ordered by startDate — that only returns markets pre-created ~24h ahead. Compute the active window’s slug deterministically:
- 5-min markets sit on 300s boundaries, 15-min on 900s boundaries
- slug =
btc-updown-5m-{floor(now/300)*300}(or15m/900)- Query Gamma
?slug=<slug>with aUser-Agentheader — Gamma 403s the default urllib agent.- The slug unix timestamp is the window OPEN time; the trading window is
[slug_ts, slug_ts + duration]. (Same fact as in short-term-accuracy — slug ts is start, not end.)
findings so far
All validation captures landed on calm tapes (~6-9 bps BTC range), so the primary book-lag question is still unmeasured. What the short runs did establish:
- RTDS is a ~1 Hz republished feed and is itself laggy. Measured structural latencies, internally consistent:
- raw Binance → RTDS-Binance: ~0.4s
- RTDS-Binance → RTDS-Chainlink: ~2.9s
- raw Binance → RTDS-Chainlink: ~3.4s (≈ sum of the above, which corroborates them)
- Conclusion: Polymarket’s RTDS Chainlink feed trails the true BTC price by ~3.4s. RTDS is a convenience feed, not a trading feed — do not trade on it. Use a direct feed (raw Binance WS, or Chainlink Data Streams direct).
- A persistent ~11 bps level gap between RTDS-Binance and RTDS-Chainlink (Chainlink lower) — likely a USDT-vs-USD basis, constant, not a timing lag.
Primary measurement still open
Does the Polymarket order book lag the true BTC price, and by how much — NOT yet answered. Every short capture hit a calm market; the directional move-detector needs actual BTC moves to measure against.
Next step: run
lag-probe --duration 28800overnight during real BTC volatility, then--analyzethe JSONL. The book-vs-direct-Binance lag distribution during real moves is the number that decides whether the latency-arb edge is worth building a bot for.
results — 14h capture, 2026-05-23/24
Ran 2026-05-23T20:32:24Z → 2026-05-24T10:32:56Z on the user’s Mac (home network, not a colo box). Watchdog clean, no incidents. 5.9 GB JSONL, ~38M+ events. Binance saw a 171.7 bps BTC range over the run — real volatility this time, not a calm tape.
the headline number — Polymarket CLOB lags real BTC
Over 2,333 directional BTC moves, 1,722 follower responses on the CLOB book:
| stat | book vs direct Binance spot |
|---|---|
| min | 100 ms |
| p50 | 300 ms |
| mean | 844 ms |
| p90 | 2,000 ms |
| p99 | 8,079 ms |
| max | 10,000 ms |
Cross-correlation agrees: best lag 300 ms (corr 0.041).
Against Binance PERP it’s effectively the same — p50 300 ms, mean 928 ms. Spot and perp are simultaneous at the 100 ms grid (corr 0.265 at lag 0 ms); any perp lead is under 100 ms and not resolvable at this resolution.
structural lags — earlier short-capture numbers held up
Now backed by 14h of data instead of a few minutes:
- RTDS Binance trails direct Binance by ~800 ms
- RTDS Chainlink trails direct Binance by ~2,600 ms — the resolution oracle is ~2.6 s behind real BTC
- Within RTDS, Chainlink trails Binance by ~2,000 ms
Self-consistency: 800 + 2,000 ≈ 2,800 vs measured 2,600 — close enough, the chain holds.
operational read
- The edge window is 300 ms – 2 s. A bot at sub-100 ms latency to Polymarket’s CLOB (colocated AWS eu-west-2 London or adjacent) beats the book on the majority of directional moves. This is not a microsecond HFT race — it’s a sluggish-book latency arb at human-readable timescales.
- Don’t trade on RTDS, it’s 800 ms – 2.6 s slow. Signal comes from direct Binance (spot or perp, doesn’t matter at this resolution).
- The market resolves on Chainlink, which itself trails real BTC by ~2.6 s. That’s the window during which the book is mispriced relative to settlement.
CLOB throughput was suspiciously low — book lag may be even faster than reported
clob_bookevent count over the 14h run was ~496K, roughly 10/sec. Earlier smoke tests saw 218–463/sec; the broken 12h run hit 463/sec. Likely cause: the recent audit’s CLOB/price channel split plus themerge_intotask may be back-pressuring CLOB events. The 1,722-response sample is still solid for the lag stats, but if CLOB updates are being thinned, the true book lag could be tighter than the 300 ms p50 we measured. Investigate before paper-trading.
what’s next
Scoping the actual bot — strategy spec, eu-west-2 infra, risk envelope, capital, execution API, paper trading first. See top-trader-edge for the current strategy thesis (the original short-term-accuracy latency-arb framing has been superseded — the edge is late-window book mispricing, not BTC-vs-book lag).
Lag measurement still useful, just not the signal source
The p50 300 ms book-lags-Binance number is a real fact about Polymarket’s CLOB and still informs the execution-side infra requirement (sub-100 ms colo in eu-west-2 is needed to act on the book before it heals). It is NOT the source of edge for the top-trader cohort — see top-trader-edge.
related
- top-trader-edge — corrected strategy thesis the bot is now scoped around
- short-term-accuracy — original (now-superseded) latency-arb framing this harness was built to size
- polymarket-fetch — workspace this crate lives in