Inspiration

Prediction markets like Kalshi and Polymarket often price the same real-world event differently. When the same binary event is listed on both platforms and buying YES on one and NO on the other costs less than $1.00 after fees, there is a spread. We wanted a tool that finds those spreads, checks that both markets really resolve on the same rules, and shows the net result after fees.

What it does

Arbitrage Agent scans Kalshi and Polymarket, pairs equivalent markets (even when they are worded differently), and computes the net spread after both platforms' fees, country-aware (US / international Polymarket fees). Opportunities appear in a live feed with realisable profit and annualised return, and a step-by-step guide shows how to place both legs yourself on the exchanges.

Key features:

  • AI event matching: embeddings plus a check of each market's resolution rules
  • Fee-aware net spread, country-aware
  • Live opportunity feed with realisable profit and annualised return
  • Step-by-step execution guide for placing the two orders manually
  • Dry-run P&L tracking and mark-to-market of the positions you record
  • Operator plan: Telegram/email alerts, Kelly sizing and risk caps, divergence signals, and first access to automated execution, which is still in final testing and not live for users

It is non-custodial: it never holds user funds, and users trade on their own Kalshi and Polymarket accounts. 0% take on user profit.

Honest limits: typical net edge is small, capital can be locked until the markets resolve, and fees, thin liquidity, leg risk and resolution-rule differences can turn a detected spread into a loss. Detected is not realised profit. Live data is public at arbitrage-agent.com/proof.

How we built it

The backend is split into layers:

  • Ingestion: persistent WebSocket clients for Kalshi and Polymarket publish orderbook updates to Redis pub/sub
  • Matcher: a background job compares markets across platforms using keyword scoring and OpenAI embeddings; matched pairs are cached in Redis
  • Engine: a reactive pipeline that reads price ticks from Redis, calculates the net spread after fees, and emits opportunities above a threshold
  • SaaS layer: FastAPI with Clerk JWT auth, a React dashboard and a Streamlit backoffice for managing subscribers

Challenges we ran into

  • Fake prices: Polymarket's Gamma API returns mid-price, not real bid/ask. We switched to the CLOB endpoints to get actual orderbook prices, because the spread calculation was wrong before that fix.
  • Fee bug: is_international was hardcoded to False, so the 2% international fee was missing from the spread. It was hard to catch because the logic was right and the input was wrong.
  • Embedding cost vs. latency: matching hundreds of markets on every price tick was too slow, so market discovery runs about every 5 minutes while price updates are continuous.

What we learned

The math of prediction-market arbitrage is simple. The hard part is getting the right prices, the right fees and the right resolution rules, and making sure none of those silently breaks.

What's next for Arbitrage Agent

  • Roll out automated execution to Operator users after final testing
  • More platforms as they open APIs
  • Position sizing by historical edge per market category

Built With

Share this project:

Updates