The lab kit
The harness behind every study on this site, as source. No strategy in it. The free starter is on GitHub; the full kit is the Desk tier's download.
By The Heron.
Every lesson on this site came from one codebase. It contains no trading idea and no quoting logic. It is the machine that tested about forty strategies on Kalshi, with real money, and told the truth about each one: how to talk to the exchange without lying to yourself, how to test an idea before it costs anything, how to run real money in blocks that stop on their own, and how to seal the record so nobody, including me, can quietly edit it later.
That machine is the lab kit. It is what a builder spends the first three months writing before their idea ever trades, and it is the part they get wrong in the same places I did.
What is in it
Python, SQLite, five libraries. It runs on a six dollar droplet. Each module opens with a dated note on why it exists and which mistake it fixed.
| Module | Job | Tier |
|---|---|---|
| kalshi_client | Signed requests, place and rest and cancel orders, the shard index on every order, fills, a heartbeat | Desk |
| fills_sync | The ledger from the exchange's own fill records. Every stop reads this, never local state | Desk |
| blocks | Pre-registered blocks: day stop, lifetime stop, kill bar, stand-down, and the grade that judges the block | Desk |
| seal | Nightly SHA-256 seal of the ledger and the proof page it prints | Desk |
| paperlane | The paper engine: your own tape, resting paper bids, a fill only when a real print crosses your price | Desk |
| kalshi_ws | Websocket recorder: every best-price change and sampled book depth, the one thing the API never gives back | Desk |
| cfindex | The CF Benchmarks settlement index, the number crypto markets actually settle on | Desk |
| lane_watch, watch_kalshi | A lane that is alive but frozen; a fee schedule or shard that changed under you | Desk |
| fees | Series-aware fees: which 130 series charge makers and how the rounding bites | Free |
| histfill | Backfill Kalshi's free history: markets, trade tape, one-minute candles | Free |
| grade_family | Grade a series from the public tape at the honest unit before you write a line | Free |
| kalshi_facts | What a ticker means and what settles a series, from the command line | Free |
What is not in it
Any strategy. What the lab quotes is public on every board; how it quotes is not, because market making is the one family where readers copying it damages the thing being measured. The kit is the harness, and the harness contains no edge. No recorded market data either: Kalshi's terms do not permit redistributing it, and the recorders here will build your own tape from the day you start them.
The rules the code enforces, and where each came from
- Never hold the database's write lock across a network call. A sync that fetched inside its transaction starved forty processes for a night.
- Register an order on its own connection, or cancel it. An order the ledger cannot attribute is invisible to every stop.
- Run the stops even when the sync failed. The lane that skipped its checks because it could not sync is the lane that breached its day stop.
- Carry the shard index on every order and every cancel. Crypto moved to a second matching engine and every order 404'd for nine hours; later, five cancels reported success while the orders stayed live and filled 356 contracts.
- Fee type belongs to the exact series. KXATPMATCH charges makers. KXATPCHALLENGERMATCH does not.
- Per-fill P&L keys off which side of the book you were on, never off the result alone. The naive formula gets the sign wrong on sold-yes fills and once produced a forty dollar error.
- Ticker times are Eastern. Use the API's close_time, or every window is four hours wrong, five in winter.
- Watch the historical cutoff. Fills older than a moving boundary vanish from the fills endpoint without an error.
The free starter
Four of the tools, no key needed, on GitHub: Pondletter/labkit-starter. The fee schedule as code, the free history backfill, the series grader, and the ticker and settlement facts. MIT licence. Start there.
Building it with an AI assistant? The starter includes KALSHI-CONTEXT.md, a file to paste into Claude, ChatGPT or Cursor before it writes a line: every trap on this page as facts the model can check its own code against, with no strategy in it. Your assistant can write the bot. It does not know what the exchange does, and this is the part it gets wrong by default.
The full kit
The full harness is the Desk tier's download, $99 a month: the exchange client, the fill reconciler, the block machinery with its stops and its grade, the paper engine, the recorders, the watchers and the nightly seal, with a README that doubles as the first hour and two examples, a first paper lane and a first live block that is dry until you arm it. Updated monthly. Kit and Desk members download it at /kit/ while signed in.
It is the lab as it runs, with the notes, not a supported product. Questions go to the Desk queue, which is also where you can propose what the lab tests next.
Before you download anything
Read Before you build a Kalshi bot. The kit enforces the lessons; that page explains them, with the numbers, in the order you will need them.