Open source

Polkas

A prediction-market arbitrage system that watches Kalshi and Polymarket for opportunities, with an Axum backend, WebSocket market data, and a TypeScript frontend.

Role
Author
Status
Active
Stack
Rust, TypeScript

What this project shows

Context

Personal open-source end-to-end system for monitoring prediction-market data and surfacing arbitrage opportunities.

My contribution

Author of the backend, market matching, persistence, and frontend integration described in the repository.

Why it matters

Shows how I approach concurrent feeds, data freshness, matching uncertainty, and human-facing signals.

Public evidence

Highlights

  • Kalshi and Polymarket feeds matched into arbitrage opportunities
  • Axum and Tokio backend with WebSocket market data
  • SQLite persistence so a restart keeps signal history
  • React and TypeScript live view for the signals

Prediction-Market Arbitrage - Rust and Axum Backend - WebSocket Market Data - React Frontend

Overview

Polkas monitors the Kalshi and Polymarket prediction markets and looks for arbitrage opportunities between them. It is an end-to-end system rather than a library: an Axum/Tokio backend, an HTTP API, WebSocket market data, market matching, SQLite persistence, and a React/TypeScript frontend. It can also place the trade, with auto-trade limits (a maximum trade count and amount) rather than unlimited automation.

Problem

The same real-world question is listed on two venues at two prices. Finding the discrepancy is a query; acting on it requires both books to be current, the two markets to be identified as the same question, and the resulting signal to reach a human before it expires.

Constraints

  • Two venues, two APIs. Nothing can be assumed to be shared beyond the concept of a market.
  • Streaming first. Polling two venues at a useful frequency is both slow and rate-limited, so the books are maintained from WebSocket feeds.
  • Matching is the hard part. An arbitrage pair is a judgement about equivalence, and a wrong match is worse than a missed one.

Architecture

Kalshi and Polymarket feeds are matched into opportunities, stored in SQLite and exposed through an HTTP and WebSocket API to a TypeScript frontend.

Mermaid preview

Persistence sits between detection and presentation so that a restart does not lose the history that makes a signal interpretable.

Technical decisions

DecisionAlternativeWhy
Rust backendA scripting languageTwo concurrent feeds with matching on the hot path
WebSocket market dataPollingPolling either lags or trips rate limits
SQLiteA server databaseThe working set is small and the deployment stays single-process
Separate frontendServer-rendered pagesThe UI is a live view, not a document

Tradeoffs

Matching heuristics produce false positives, and a false positive in an arbitrage tool is expensive; the system therefore treats the signal as the primary output, and puts execution behind an auto-trade path bounded by a maximum trade count and amount rather than leaving it unlimited. Keeping the frontend separate also means two runtimes and two dependency trees for one tool.

Results

The repository documents this functionality. I am not quoting returns, fill rates or latency figures - the honest statement is that it detects candidate pairs, can place trades within configured limits, and that its usefulness depends on market conditions I have not measured systematically.

Lessons learned

In market data, the failure that matters is a stale book that still looks alive. Treating “last update time” as part of the data, rather than as monitoring, is what makes an arbitrage signal trustworthy.

Verify

The repository documents its own checks:

cd backend && cargo test
cd frontend && npm run build

Search this site