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
Vendored
+15
-2
@@ -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`.
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"markets": [
|
||||
{
|
||||
"ticker": "KXFIBAECUPSPREAD-26NOV111230SZOZIG-SZO23",
|
||||
"status": "determined",
|
||||
"created_time": "2026-11-11T13:04:40.111474Z",
|
||||
"open_time": "2026-11-11T13:06:00Z",
|
||||
"close_time": "2026-11-11T19:12:27Z"
|
||||
},
|
||||
{
|
||||
"ticker": "KXFIBAECUPSPREAD-26NOV111230SZOZIG-SZO19",
|
||||
"status": "determined",
|
||||
"created_time": "2026-11-11T13:04:40.111474Z",
|
||||
"open_time": "2026-11-11T13:06:00Z",
|
||||
"close_time": "2026-11-11T19:12:27Z"
|
||||
},
|
||||
{
|
||||
"ticker": "KXFIBAECUPSPREAD-26NOV111230SZOZIG-SZO15",
|
||||
"status": "determined",
|
||||
"created_time": "2026-11-11T13:04:40.111474Z",
|
||||
"open_time": "2026-11-11T13:06:00Z",
|
||||
"close_time": "2026-11-11T19:12:27Z"
|
||||
}
|
||||
],
|
||||
"cursor": "CgYIm_zS1wYSKEtYRklCQUVDVVBTUFJFQUQtMjZOT1YxMTEyMzBTWk9aSUctU1pPMTU"
|
||||
}
|
||||
+2852
File diff suppressed because it is too large.
Load diff
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"markets": [
|
||||
{
|
||||
"ticker": "KXNCAAWBTOTAL-26NOV11QUINSJU-106",
|
||||
"status": "active",
|
||||
"created_time": "2026-11-11T19:12:59.634595Z",
|
||||
"open_time": "2026-11-11T19:14:00Z",
|
||||
"close_time": "2026-11-13T19:00:00Z"
|
||||
},
|
||||
{
|
||||
"ticker": "KXNCAAWBTOTAL-26NOV11USAFAU-160",
|
||||
"status": "active",
|
||||
"created_time": "2026-11-11T19:12:39.6174Z",
|
||||
"open_time": "2026-11-11T19:14:00Z",
|
||||
"close_time": "2026-11-13T18:00:00Z"
|
||||
},
|
||||
{
|
||||
"ticker": "KXESOCCERGAME-26NOV111710EDERBONY-TIE",
|
||||
"status": "active",
|
||||
"created_time": "2026-11-11T19:11:51.921073Z",
|
||||
"open_time": "2026-11-11T19:12:00Z",
|
||||
"close_time": "2026-11-25T22:10:00Z"
|
||||
}
|
||||
],
|
||||
"cursor": "CgwI9_vS1wYQ6OqZtwMSJUtYRVNPQ0NFUkdBTUUtMjZOT1YxMTE3MTBFREVSQk9OWS1USUU"
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"markets": [
|
||||
{
|
||||
"ticker": "KXEUROCUPTOTAL-26NOV121400MAXSKY-179",
|
||||
"status": "initialized",
|
||||
"created_time": "2026-11-11T19:14:08.970811Z",
|
||||
"open_time": "2026-11-11T19:19:08Z",
|
||||
"close_time": "2026-11-14T19:00:00Z"
|
||||
},
|
||||
{
|
||||
"ticker": "KXEUROCUPTOTAL-26NOV121400MAXSKY-171",
|
||||
"status": "initialized",
|
||||
"created_time": "2026-11-11T19:14:08.970811Z",
|
||||
"open_time": "2026-11-11T19:19:08Z",
|
||||
"close_time": "2026-11-14T19:00:00Z"
|
||||
},
|
||||
{
|
||||
"ticker": "KXEUROCUPTOTAL-26NOV121400MAXSKY-163",
|
||||
"status": "initialized",
|
||||
"created_time": "2026-11-11T19:14:08.970811Z",
|
||||
"open_time": "2026-11-11T19:19:08Z",
|
||||
"close_time": "2026-11-14T19:00:00Z"
|
||||
}
|
||||
],
|
||||
"cursor": "CgwIgP3S1wYQ-Mz1zgMSJEtYRVVST0NVUFRPVEFMLTI2Tk9WMTIxNDAwTUFYU0tZLTE2Mw"
|
||||
}
|
||||
Reference in new issue
Block a user