Back to all projects
Product2026

Prediction Market AI

5-agent AI pipeline for analyzing prediction markets across Polymarket, Kalshi, Metaculus, and Manifold.

An end-to-end system that scans 500+ markets per cycle across four prediction platforms, runs a 5-agent pipeline to generate calibrated probability forecasts, manages risk with dynamic Kelly sizing, and reviews outcomes to retrain its own ML model automatically.

Role
Builder
Team
Solo project
Duration
2026
Tools
PythonFastAPIOpenAI APIXGBoostNext.jsWebSocketSQLAlchemyAPScheduler

Overview

Prediction markets aggregate crowd forecasts into real-time probability signals. The challenge is that extracting actionable intelligence requires scanning hundreds of markets, researching each one, predicting probabilities, sizing risk, and reviewing outcomes, all in a structured, automated workflow.

Agent Pipeline

I built a 5-agent system where each agent handles one stage of the pipeline:

ScanAgent fetches markets from all four platforms and scores them by liquidity, volume, and time-to-resolution to surface the most actionable candidates each cycle.

ResearchAgent extracts keywords, pulls relevant news and Reddit posts, applies sentiment analysis, and generates a GPT-powered research summary for each market.

PredictionAgent runs a 3-layer prediction stack: a rule-based adjustment anchored to market price, a GPT-4o-mini superforecasting prompt, and an XGBoost calibration model trained on resolved outcomes. The three outputs are blended dynamically based on LLM confidence and historical sample size.

RiskAgent applies a 3-gate filter (minimum confidence, edge, and expected value thresholds) and sizes positions using dynamic Kelly criterion fractions tied to confidence tiers, capped at a percentage of market liquidity.

ReviewAgent detects expired markets, fetches actual outcomes via the Polymarket Gamma API, computes PnL, runs LLM failure analysis across 7 error tags, and triggers automatic ML model retraining.

Real-Time Monitoring

A persistent WebSocket connection to Polymarket subscribes to 50-market batches and detects price jumps above 3%, triggering immediate re-analysis for the affected market. Six scheduled jobs handle scan, full pipeline, fast pipeline, ultra-fast pipeline, review, and arbitrage scanning at different intervals.

Arbitrage and Backtesting

A cross-platform arbitrage detector uses Jaccard word-overlap title matching to find the same market listed on multiple platforms at different prices. A full backtesting engine computes Brier scores, calibration tables, and cumulative PnL curves. Every BUY decision generates an automatic paper trade tracked through resolution.