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]`.
This commit is contained in:
pascal committed 2026-11-11 20:54:17 +00:00
1 parent 480ee3ad2d
commit 1a5bbcd602
33 files changed
+8150 -1846

No files matched your search

+15 -2
View File
@@ -1,8 +1,10 @@
# 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).
`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`
@@ -21,3 +23,14 @@ Gamma pages read by `src/polymarket/gamma.rs` (no network in tests).
- `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`.