This repository has been archived on 2026-11-16. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
pascal 1a5bbcd602 feat!: a generic core, and Kalshi through it
The orchestrator, the connection loop and the book thread's shell move to
src/core/, generic over an Exchange and its loss rule (ADR 0004).
Polymarket runs through it unchanged. Kalshi joins: a signed handshake
(KALSHI_KEY_ID_FILE, KALSHI_PRIVATE_KEY_FILE), a reconnect on a skipped
sequence number, first one wins by clock and rank, and its market listing
with markets tracked from three hours before they open.

Breaking: the exchange is now the first argument,
`engineering-challenge <polymarket|kalshi|kalshi-demo> [OUTPUT]`.
2026-11-11 20:54:17 +00:00
..

Test fixtures

Two recordings of Polymarket's market channel, replayed by the tests in src/polymarket/feed.rs (the first also by socket_tests.rs's routing test), and Gamma pages read by src/polymarket/gamma.rs; one recording of Kalshi's demo, replayed by src/kalshi/feed.rs, and listing pages read by src/kalshi/listing.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, closed and acceptingOrders were added in sprint 03 (the ids from the recorded books' market).
  • gamma-created.json, gamma-closed.json: one /markets/keyset page each (limit=10) of the newest live markets by createdAt and the latest closed by closedTime, 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, 8 PONGs.
  • 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 its connection (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].
  • kalshi-frames-two.jsonl: 90 s (2026-11-11, from 18:43:27 UTC) of the demo's orderbook_delta channel on two connections, the 26 markets with the most 24 h volume, in the same line shape. Connection 0 asked for every book again every 3 s (get_snapshot, 780 books); connection 1 left five markets at 60 s and took them again at 65 s. Recorded with the throwaway recorder of sprint 06 (../kalshi-spike/, outside the repo).
  • kalshi-open.json, kalshi-unopened.json, kalshi-closed.json: one page each (limit=3, mve_filter=exclude) of production's listing by status=open, status=unopened and status=closed&min_close_ts, 2026-11-11 ~19:35 UTC, trimmed to ticker, status, created_time, open_time, close_time.