Archived
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:
33 files changed
+8150
-1846
No files matched your search
+18
-5
@@ -66,12 +66,16 @@ abstraction is *extracted* once a second exchange exists, not designed up front.
|
||||
than sprint 04's; quiet subscriptions are rare (26 resubscribed, none
|
||||
quiet again) and no connection fell silent (sprint 05's Outcome).
|
||||
|
||||
6. **Extension 3 — generic core + Kalshi adapter** — *not started*
|
||||
Extract the exchange-agnostic core (the `NormalizedEvent` seam) from the
|
||||
working Polymarket code, then add a Kalshi adapter so both exchanges run
|
||||
through the same core. The abstraction is extracted from two concretes here,
|
||||
not before. Requires a Kalshi API key.
|
||||
6. **Extension 3 — generic core + Kalshi adapter** — *done (2026-11-11)*
|
||||
The exchange-agnostic core extracted from the working Polymarket code,
|
||||
and Kalshi added through it. Each exchange supplies its websocket layer
|
||||
and its loss rule ([ADR 0004](adr/0004-exchange-seam.md)); on Kalshi,
|
||||
first one wins by clock and rank.
|
||||
Sprint: [../roadmap/06. generic core and kalshi.md](../roadmap/06.%20generic%20core%20and%20kalshi.md).
|
||||
*Ends:* both Polymarket and Kalshi work through one generic core.
|
||||
Result: 10-minute live runs of each, reconciled; Polymarket's losses no
|
||||
higher than sprint 05's; Kalshi on its demo (about 245,000 markets on 110
|
||||
connections), production not run for lack of a key (sprint 06's Outcome).
|
||||
|
||||
7. **Extension 4 — latency experiments + writeup** — *not started*
|
||||
Experiment with faster connections (first-after-maintenance, connection
|
||||
@@ -125,3 +129,12 @@ abstraction is *extracted* once a second exchange exists, not designed up front.
|
||||
- Fewer Snapshots for unchanged books (the brief asks for every symbol every
|
||||
minute: ~130 MB a minute at full coverage).
|
||||
- Re-reading a market's `orderMinSize` / `negRisk` if they can change.
|
||||
- A Kalshi production run, once a production key exists.
|
||||
- Retrying a failed rescan sooner than the next hourly one (`maybe`: Kalshi's
|
||||
three-hour opening window covers one failure).
|
||||
- One place for the two rules' resync bookkeeping (asking for a fresh book,
|
||||
again on leave and at the minute), in the shell (`maybe`: it means
|
||||
rewriting Polymarket's).
|
||||
- Telling Kalshi's book at a market's close, and a connection's book merely
|
||||
ahead of the other's stream, from a real loss (sprint 06 logs all three as
|
||||
a loss; the Snapshot is right either way).
|
||||
Reference in new issue
Block a user