For Agents

Living index of themes for this project. Each H2 is a topic; bullets are wikilinks to related notes. Updated by obsidian-documenter when documenting work. Read by historian at bootstrap. Topics kept alphabetical.

Algorithm Design

  • copy-trade-algorithm — per-trade edge → trader copy_score → live trade-signal scoring, with MM filter and time decay. Layers 1-4 shipped. Backtest verdict: gate works, copy_score magnitude doesn’t — kept as observation tool, magnitude ranking removed.
  • short-term-accuracy — edge-over-price ranking for crypto Up/Down markets; Wilson lower bound, split-half persistence
  • top-trader-edge — strategy v2 thesis for the latency-arb bot. Edge is late-window 5m longshot reversion + momentum-chase, signal = book state + time-in-window. Two lanes on the top wallets; 0xd189664c at 77.8% ROI is the purest expression.
  • polymarket-fetchcompute-metrics / ranked-traders CLI + pm_trader_metrics snapshots

Backtesting / Validation

  • copy-trade-algorithm — multi-window backtest, Gamma API resolution data fix (61K markets), edge-persistence diagnostic (~0.21 Spearman), verdict: no demonstrated copy-trade edge vs naive PnL ranking
  • short-term-accuracy — split-half persistence test on 21 wallets (Spearman 0.34, p=0.08, underpowered); per-wallet edge_z up to +11.3 is solid; edge confirmed copyable (in-window latency arb, not post-resolution sniping)

Architecture

  • polymarket-fetch — workspace layout, Selector trait (4 impls), auto-chain pipeline overview, trades fetcher, metrics layer, Telegram adapter

CI / Build

  • ci — GitHub Actions pipeline: fmt, clippy, cargo-deny, Docker build. Key gotcha: pin rust-toolchain.toml (now 1.95.0) so local and CI clippy lint sets match. cargo-deny moved off the Alpine Docker action; RUSTSEC advisories cleared by bumping testcontainers rather than ignoring them.

CLI

  • polymarket-fetchrun / consensus / latest / diff / history / migrate / trades-since / trades-sync / compute-metrics / ranked-traders / telegram-test / telegram-discover, plus selector + CP flags and global --silent

Database Schema

  • polymarket-fetchpm_runs (now with selector / selector_params), pm_leaderboard_snapshots, pm_intersections, pm_traders, pm_positions, pm_consensus_positions, pm_selected_wallets, pm_trades, pm_trader_metrics

Latency Arbitrage

  • short-term-accuracy — high-edge Up/Down wallets thought to run a Binance→Polymarket latency arb; book drifts ~3-4c per 10% of window so a slightly-late copy keeps most of the +8.7pp edge. Thesis superseded — see top-trader-edge.
  • lag-probe — read-only harness measuring book lag vs true BTC price; captures 4 feeds + lag distribution. 14h capture (2026-05-23/24, real volatility) measured CLOB book lag vs direct Binance at p50 300 ms / mean 844 ms / p99 8 s. Edge window 300 ms to 2 s; sub-100 ms colo in eu-west-2 beats the book. RTDS Binance ~800 ms slow, RTDS Chainlink (settlement oracle) ~2.6 s slow. Caveat: clob_book throughput dropped ~20×, possible back-pressure — true lag may be tighter. Lag is real but not the source of the top-cohort edge — see top-trader-edge.
  • top-trader-edge — strategy v2 thesis. Naive lag-arb failed M0 at 46% win rate; real edge is late-window 5m longshot reversion (price ≤ 0–0.10 × late cell) + late-window momentum-chase (≥ 2¢ bid in last 30s, hit rate 73.4%, edge +4.7¢). Cross-asset (BTC+ETH+SOL+XRP). Validated on 0x75cc3b, purest on 0xd189664c (77.8% ROI / $9.4K PnL).

Gotchas / Bugs Fixed

  • polymarket-fetch — run-status leak, auto-chain self-skip, paginator infinite loop, DB password URL encoding, percent_pnl numeric overflow, dead-position pollution, strict 3-of-3 starvation, negative×negative copy_score gate
  • short-term-accuracy — survivorship bias from joining outcomes on the traded side (losing-only markets dropped, hit rates inflated); always derive market outcome authoritatively

Infrastructure / Colocation

  • short-term-accuracy — Polymarket order matching is off-chain (centralized CLOB); Polygon only settles. No “Jito for Polymarket” — the race is network latency to Polymarket’s CLOB API on AWS eu-west-2 (London). Colocate in eu-west-2 / London-Dublin Equinix; US-East ~130ms is too slow.

Notifications / Telegram

  • polymarket-fetchtelegram.rs + notifier.rs fire-and-forget, lifecycle/milestone/error notifications, --silent global, BotFather setup flow, rich per-wallet messages

Polymarket API Quirks

  • polymarket-fetch — uppercase query params, vol vs volume, stringified rank, OVERALL category sports bias, trades endpoint offset hard-capped at 3000
  • lag-probe — RTDS filters must be object/array-shaped or it 400s the whole subscription; Gamma 403s the default urllib User-Agent; find the active btc-updown market by computing its slug on 300/900s boundaries, not paging closed=false

Reverse-Engineering Top Traders

  • top-trader-edge — full pass on 0x75cc3b’s 43,734 trades cross-validated on 8 other high-edge wallets. Falsified the earlier 3,397-markets / BTC-only / 15%-into-window characterization; identified two lanes (longshot reversion + momentum-chase), both 5m-only, both late-window. At least 2 distinct edge-bearing strategies coexist in the cohort (the other cluster — 0x7523cafc, 0xb27bc932 — does favorites-only in 15m).

Selectors

  • polymarket-fetch — TopN, Manual, MinTenure wrapper, ConsistentlyProfitable + score JSON shapes, --require-windows 1..3 loosening

Trades Pipeline

  • polymarket-fetchpm_trades table, trades-sync CLI with --all-watched / --since / --concurrency, per-wallet incremental resume, 3000-offset cap handling. Live: 53k trades / 24 wallets.

TODO / Backlog

  • polymarket-fetch — load launchd plist / wire cron for scheduling, copy regenerated types into CRM packages/shared/src/database.types.ts
  • copy-trade-algorithm — phase 5: real-time trade-signal scoring + Telegram alerts; phase 6: threshold backtest tuning