All projects

19 / Ventures & FinancePrediction Market

Kalshi Crypto Market-Making and ML Trading Bots

Automated market making and machine-learning bots trading real money on 15-minute crypto markets · March – July 2026

Drawing of a robot between a stack of bids and a stack of offers
Overview

Spread capture on thinly traded markets

The venue was Kalshi, a regulated US exchange for yes-or-no contracts. Every 15 minutes it opens a new market on whether a coin’s price will finish the window higher, and each contract pays $1 or nothing.

On the less popular coins the gap between the best bid and best offer was often 10 to 60 cents on a one-dollar contract. My thesis was that a small automated market maker could rest orders on both sides and earn that gap. Later I tried to predict the outcomes outright with machine learning.

The market maker was profitable with real capital, and the models never beat the market’s own price. The most valuable result was a correct method for measuring those outcomes.

Live trading with real capital. Results were reconstructed from the bots’ logs of exchange fill messages, not taken from an account statement. A classmate contributed baseline machine-learning code; the trading systems and models described here are mine.

What I built

Systems built

  • Market making

    Live quoting bot on seven coins

    Async Python bots that rest bids on both sides of each 15-minute market over a WebSocket feed, skew quotes as inventory builds, and roll to the next market every quarter hour.

  • Data

    Market-data recorder

    My own top-of-book recorder, which ran from March 28 to August 1 and captured 44.4 million rows across about 10,000 markets per coin, plus Coinbase spot prices.

  • Machine learning

    Six model generations

    Liquid neural networks, a LightGBM meta-model, PPO reinforcement learning, transformers and a temporal convolutional network, trained on the recorded data.

  • Accounting

    Profit reconstruction from exchange records

    Every result on this page was reconstructed from raw fill messages and settlements, after each of the project’s own profit trackers was found to be wrong.

01 · Market making

Market-maker versions and live results

The first analysis measured where the spreads were. Bitcoin and Solana traded 1 to 5 cents wide; BNB and HYPE averaged 30 to 60. I wrote the first bot on the night of March 28 and it was trading live on five coins by 2:17 a.m. Over the next four weeks it went through about ten versions.

Two charts of bid-ask spread in cents for seven coins from March 28 to 31. BNB and HYPE run between 20 and 80 cents, DOGE around 10, XRP, ETH and SOL around 5, and BTC near 1 to 2. The lower chart shows the same ordering by hour of day.
Spread by coin over the first four days, and by hour of day. The widest spreads, and the most room for a market maker to earn, are on the thinly traded coins
Market-maker versions run live, March 28 to April 24, 2026.
VersionDatesWhat changed
Simple quoting scriptsMar 28 – 29One script per coin, improving the best bid by 1¢
Orchestrator and auto-tunerMar 29 – Apr 1Seven worker processes, a database, a 15-minute analysis engine and a Coinbase spot circuit breaker
Simple scripts, second runApr 1 – 11Reverted to standalone bots with relaxed price limits; Bitcoin dropped
Optimized production lineApr 11 – 24Optuna-chosen parameters, an order-book imbalance shield and dynamic sizing
Contracts traded live by coin · March 28 – April 24, 2026 · 36,604 in total
  • BNB9,615
  • XRP7,992
  • HYPE7,570
  • ETH3,777
  • SOL3,499
  • DOGE2,741
  • BTC1,410

The thinly traded coins, where spreads were widest, account for most of the volume

The simplest bots did as well as the most elaborate ones. The orchestrated fleet, with its database, dashboard and self-tuning parameters, ran for two and a half days and did not outperform the plain scripts that replaced it.

Ordinary spread capture was positive but small, and 83% of its contracts were filled as resting orders. A side branch that applied the same quoting to sports, weather and other non-crypto markets broke even after fees.

02 · Accounting

Profit tracker audit

The hardest problem in the project was measuring profit correctly. A later audit rebuilt every result from the raw exchange messages, per market: cash paid, fees, and one dollar for each winning contract held at expiry. Every profit tracker I wrote disagreed with that reconstruction, usually in my favour.

The reconstruction counts all cash, fees and settlements.
MeasurementTracker against reconstructionCause of difference
Market maker, first four daysOverstated the profitCounted matched buy-and-sell pairs only and left out contracts held to expiry
Market maker, whole runOverstated the profitSame method: inventory left to expiry lost money, because the positions that fail to exit are mostly the losers
Transformer bot’s own logShowed a profit where the reconstruction shows a lossBooked early exits only; 58 of the 60 positions held to expiry lost and were never recorded
Transformer backtest that justified going liveShowed a profit where the reconstruction shows a lossSettled trades on a Coinbase price proxy, not on the exchange’s actual result
03 · Machine learning

Model performance against the market price

From late April I tried to predict the contracts directly, training on my recorded order-book data and Coinbase spot prices: liquid neural networks feeding a LightGBM meta-model, reinforcement-learning agents, and then transformers. One transformer classifier traded live for five days in May. Its own log showed a profit. The reconstruction shows a loss.

Three charts comparing a transformer model with the Kalshi mid price. Calibration curves for both lie close to the diagonal. When the two disagree, the model is closer to the truth only 23 to 40 percent of the time. The model's Brier score is higher than the market's in all three time-to-expiry buckets.
A check I built on May 14, before going live: when the model and the market disagreed, the market was right more often (centre), and the market’s error was lower in every time bucket (right)
  • Labels

    Proxy training labels

    Training labels came from Coinbase prices, which disagreed with the exchange’s real settlement in 8 to 12% of markets. The backtest used the same proxy, so its agreement with the model did not reflect real settlement.

  • Information

    Publicly available inputs

    The inputs were the top of the order book and the spot price, which every participant sees. The early models predicted the result correctly 62 to 65% of the time; “is the price above 50¢” was right 72% of the time.

  • Evaluation

    Test-set contamination

    Early stopping and parameter searches on the test set, random splits of overlapping windows, and searches of 1,000 trials over about 220 trades all produced results that did not hold.

  • Data bugs

    Zero-valued features and time-zone errors

    A file-naming rule meant the trade-flow features were zero in all training data, and recorder timestamps were labelled with the wrong time zone for five weeks.

Conclusion. Passive quoting on thin markets was mildly profitable and not worth its operational burden at that size. The machine-learning track showed no edge: no model beat the market price. The checks I ran at the time, including the chart above, had already shown this, and I traded anyway. That is the lesson I carried most directly into later projects.

Timeline

Timeline of about twelve system generations

  1. Mar 28

    Recorder starts. First market maker written and live the same night on five coins.

  2. Mar 29 – Apr 10

    Orchestrated fleet, then simpler bots. A side branch quotes non-crypto markets and breaks even.

  3. Apr 11 – 24

    Optimized production line with Optuna-chosen parameters. Market making stops on April 24.

  4. Apr 26 – May 19

    Machine-learning track. A transformer bot trades live for five days and loses.

  5. Jul 5

    A final convolutional model is built and never traded.

All dates are 2026. Live figures are reconstructions from bot logs, with no account statement to confirm them; backtest figures are labelled as such. Past performance does not predict future results. Nothing here is investment advice.