Quant · 2026
Kalshi–IBKR Arbitrage Engine
Two markets often price the same event differently. This is a Go service that watches both at the same time, spots when the difference is bigger than the fees, and trades the gap.
What it is
Kalshi is a market for trading on whether specific events will happen — will the Fed cut rates next meeting, will it snow in NYC by Christmas. Many of those events also have related options on the regular stock market. Different crowds price them, and the implied probabilities sometimes drift apart by more than fees. The engine watches both venues, finds the gap, and trades it.
The hard part isn't spotting the divergence — it's keeping the books consistent across two venues, not double-booking the same dollar of collateral, and not trusting a single venue's heartbeat to decide when to bail out.
How it works
Twelve Go services connected by Redis (hot consolidated book, event dedup) and Postgres (source of truth for capital and positions). Five arbitrage scanners run continuously: two-leg, three-leg, cross-venue, strike-ladder, time-structure. They share one fee model so the math agrees.
- Capital FSM. Every opportunity goes through reservation → commit → realize, with state in Postgres. Failed legs roll back deterministically — you can't end up half-hedged.
- Integer-cent accounting. Floats are forbidden for money. Prices in ticks, PnL in cents. Removes a class of off-by-epsilon bugs.
- Per-venue kill switches. Independently triggerable. If Kalshi's WS goes dark, the engine flattens the IBKR side rather than sitting on a hedge it can't unwind.
- Observability. Prometheus + Grafana, alerts routed to a pager-duty-shaped handler. Local stack on Docker Compose.
Where it's at
Production-shaped infrastructure, small live caps. The engine finds and logs arbitrage continuously; live trading is gated behind manual promotion while I shake out edge cases in the FSM. "Production" here means production-shaped, not meaningful PnL — that comes from raising the caps once the live run is boring for long enough.