← Back
Project

Kalshi Backtester

Python 3.11 · asyncio · Parquet · 440 tests · 2026

A research and execution framework for systematic strategies on Kalshi event contracts: rules-based signals run across a universe of recurring markets, evaluated statistically, combined into a portfolio, and executed with realistic costs. It is built correctness first, because the failure that matters in a backtester isn't a crash. It's a number that looks right and isn't.

Architecture

DataUniverseAlphaPortfolioExecutionAnalyticspoint-in-time panel → audited universe → alphas → fees, sizing, constraints → fills → attribution
Data flows one way; alpha code cannot reach settlement or future bars.

Order book & fill modeling

For resting orders, the engine replays each taker order's prints through the recorded book plus our own orders, in price order. Volume that printed at a level was resting before us, so it fills first. Our order fills only if the taker clearly went through it. Step through it:

11¢10¢9¢8¢7¢

A recorded L2 snapshot of the YES asks.

There are two execution paths. A bar engine models latency in bars, caps size at a fraction of each bar's volume, and fills limit orders only on trade-through. The L2 tape replay above is queue-aware and pessimistic. Both share one fee model, charged per fill and rounded up to the cent, with maker fees looked up per series. A parity test holds the live engine's replay to the research backtest: the same order intents, and P&L within 1%.

Not fooling yourself

Known limitations

Status

A small set of alphas is in paper trading on the live feed. Strategy details aren't public.