Skip to content
All work

Markets

Kalshi Market Maker

An inventory-aware market maker for prediction markets, built to find out whether passive quoting has an edge.

ResearchNo public link

A market maker earns the spread and pays for adverse selection and fees. This system quotes both sides of Kalshi binary markets around a fair value, leans against its own inventory, and refuses to quote when any risk check fails.

It doubles as a research platform: recorded public market data, replay, and a ledger of hypotheses with train, validation and holdout splits. The research question was answered: no viable edge, which is the result the system was built to be able to report.

Status
Dry-run and paper trading only; it never traded live. The study concluded with no edge found.
Stack
Python, asyncio, FastAPI, SQLite, Redis, Docker

Why it exists

The question is whether passively quoting both sides of Kalshi's sports markets earns money after fees.

It's hard because the traders who take your quote often know more than you do, and on small orders the fees can eat the whole spread. Demo markets have no real traders in them, so the economics have to be studied on recorded production data.

Try it

The real quoting rule on a synthetic book. Drag inventory and watch the quotes lean. This is a faithful demo built for this site with fictional data, not the product itself.

Quote ladder · Faithful demo · fictional data

One run through it

  1. Read the book

    The feed updates a local order book. A gap in the sequence pulls the quotes and forces a resync.

  2. Price both sides

    On each tick, a clamped fair value becomes two quotes: fair value plus skew, plus or minus the half-width.

  3. Pass the gate

    The risk gate allows the quote or escalates, and the order manager reprices only on real drift.

  4. Write the test first

    A hypothesis and its pass criteria are written down before anything runs.

  5. Replay it

    Replay uses no future data. Real trades have to authorize each fill, with fees and latency counted.

  6. Score it

    Results are scored on training data, then validation, next to a worthless control.

What it does

  • Order book

    YES and NO ladders, microprice, depth and book health per market.

  • Fair value

    Midpoint, EWMA, microprice or a composite, with a cap on how fast fair value can move.

  • Quoting

    Quotes at fair value plus inventory skew, plus or minus a half-width, with sizes that shrink as inventory builds.

  • Risk gate

    About twenty checks before every quote, with graded responses from reject to halt, and a kill switch.

  • Research loop

    Recorder, replay, markouts and P&L attribution: spread captured against adverse selection, drift and fees.

Why it's built this way

  • Pessimistic fills

    A paper fill needs a real trade at the back of the queue, so the simulator can't flatter the strategy.

  • Limits that leave room to exit

    Limits judge each side's projected position, so the side that reduces risk stays quotable.

  • A second opinion on the simulator

    A model-free measure of the tape checks the simulator without relying on its fill model.

How it fits together

  1. 01asyncio services: feed, order book, fair value engine, quoting engine, risk gate, order manager.
  2. 02Post-only limit orders; live mode needs three separate flags and was never enabled.
  3. 03SQLite in WAL mode, a FastAPI dashboard, a terminal view, Docker.

In plain terms

Binary market
A contract that pays $1 or $0, so its price reads like a probability.
Market maker
A trader who quotes both sides without predicting the outcome.
Spread
The gap between the buy and sell quotes.
Adverse selection
Informed traders hitting your quote before you can pull it.
Fair value
The model's estimate of the probability.
Inventory skew
Shifting quotes against your net position to work it back down.
Microprice
A midpoint weighted by order size, leaning toward the thinner side.
Post-only
An order that's rejected if it would execute immediately.
Markout
How fair value moves after a fill. Negative means you got picked off.
Holdout
Data set aside and tested once, at the very end.
Kill switch
A file that cancels every order and blocks quoting.