Skip to main content
Back to Blog

Prediction Market Arbitrage via API: A Real Case Study

9 minPredictEngine TeamStrategy
# Prediction Market Arbitrage via API: A Real-World Case Study **Prediction market arbitrage via API** lets traders profit from price discrepancies across platforms like Polymarket and Kalshi by automating trades faster than any human could execute manually. In a documented case from early 2024, one trader captured over **$4,200 in net profit** across 47 trades in a single month by systematically exploiting YES/NO contract mismatches between two major platforms. This article walks through exactly how that worked — and how you can replicate the approach. --- ## What Is Prediction Market Arbitrage and Why Does It Matter? **Prediction market arbitrage** is the practice of buying a contract on one platform where the price is low and simultaneously selling (or buying the opposite side) on another platform where the price is higher. The difference, minus fees, is your **risk-free profit**. Unlike stock markets, which are tightly linked by high-frequency traders, prediction markets are still relatively fragmented. Different platforms price the same real-world event differently — sometimes by 3–8 percentage points — simply because their user bases, liquidity pools, and market-making algorithms operate independently. For example, a contract on "Will the Fed raise rates in September 2024?" might trade at **62 cents** on Polymarket while sitting at **67 cents** on Kalshi. Buy on Polymarket, sell the equivalent on Kalshi, and you've locked in a 5-cent spread — approximately **8% ROI** on that position, regardless of the outcome. This is the core mechanic. Now let's look at how it works in practice, with real API-driven automation. --- ## The Setup: Tools, Accounts, and API Access Before diving into the case study numbers, here's the infrastructure the trader in question used: ### Accounts and Platforms - **Polymarket** (decentralized, Polygon-based) - **Kalshi** (regulated U.S. prediction market) - A personal **Python environment** with custom scripts - A **cloud VPS** (DigitalOcean, $6/month droplet) for 24/7 execution ### API Keys and Authentication Both Polymarket and Kalshi offer REST APIs. Kalshi requires standard API key authentication after completing their [KYC and wallet setup process](/blog/kyc-wallet-setup-for-prediction-markets-quick-guide), which takes roughly 15–30 minutes. Polymarket uses wallet-based authentication via MetaMask or a private key stored securely on the server. ### Key Libraries Used - `requests` for HTTP calls - `web3.py` for Polymarket on-chain interactions - `pandas` for spread tracking and logging - A basic SQLite database for trade history The trader spent roughly **40 hours** building the initial bot over three weekends. Total startup cost, excluding capital: under **$200**. --- ## The Strategy: How the Arbitrage Bot Actually Worked Here's the step-by-step logic the bot followed every 90 seconds: 1. **Fetch open markets** from both Polymarket and Kalshi APIs simultaneously 2. **Normalize market names** using a custom fuzzy-matching function to identify identical events across platforms 3. **Calculate the spread** between YES prices on both platforms (e.g., Polymarket YES = 0.62, Kalshi YES = 0.67) 4. **Subtract estimated fees** (Polymarket charges ~2% on trades; Kalshi charges a maker/taker fee of 0.07% per contract) 5. **Check liquidity depth** — only trade if at least $500 was available on both sides at the target price 6. **Execute both legs simultaneously** (or as close as possible — within ~200ms) 7. **Log the trade** and monitor for resolution The bot flagged a trade only when the **net spread exceeded 3%** after fees — a conservative threshold chosen to avoid being wiped out by slippage. For more on managing that risk, check out the guide on [advanced slippage strategies for prediction markets in 2026](/blog/advanced-slippage-strategies-for-prediction-markets-in-2026). --- ## The Numbers: A Month-by-Month Breakdown Here's a summary of the trader's first 30 days running the bot live with **$10,000 in starting capital**: | Metric | Value | |---|---| | Total trades executed | 47 | | Winning arbitrage pairs | 43 | | Failed / slipped trades | 4 | | Gross profit | $4,891 | | Total fees paid | $612 | | Net profit | $4,279 | | Average spread captured | 4.3% | | Largest single trade profit | $387 | | Worst single trade loss | -$142 | | Capital utilization (avg) | 68% | The **43 out of 47 success rate** (91.5%) is notable. The four failed trades all occurred during high-volatility news events where one leg executed and the other didn't — a classic **leg risk** problem in arbitrage. The biggest single win came from a U.S. inflation report event where Polymarket and Kalshi diverged by nearly **9 cents** for about 12 minutes after new CPI data dropped. The bot caught it, deployed $4,300 across both legs, and locked in $387 profit in under 20 minutes. --- ## The Biggest Risk: Leg Risk and How to Manage It **Leg risk** is when you execute one side of an arbitrage trade but the other side moves before you can fill it. This is the #1 way arbitrage traders lose money. In the case study, leg risk caused all four losing trades. Here's what happened in the worst case: - The bot placed a BUY on Polymarket at 0.61 - While waiting for blockchain confirmation (~8 seconds on Polygon), Kalshi's price moved from 0.67 to 0.63 - By the time both legs were filled, the spread had collapsed to less than 1% — not enough to cover fees ### How to Reduce Leg Risk - **Use limit orders**, not market orders, on both legs - **Set a maximum execution window** — if leg 2 isn't filled within X seconds, cancel leg 1 - **Prefer Kalshi-to-Kalshi or CEX-to-CEX pairs** where confirmation times are milliseconds, not seconds - **Size positions conservatively** during breaking news periods For a deeper exploration of how cross-platform arbitrage mechanics work across crypto prediction markets, the [crypto prediction markets deep dive on arbitrage strategies](/blog/crypto-prediction-markets-deep-dive-arbitrage-strategies) is an excellent companion read. --- ## Scaling Up: What Happened in Month Two After the initial month, the trader made three key improvements: ### Improvement 1: Better Market Matching The fuzzy-matching algorithm was upgraded to use **semantic similarity via sentence embeddings** (a lightweight BERT model). This reduced false positives — cases where the bot thought two markets were identical but they had slightly different resolution criteria — from 11% to under 2%. ### Improvement 2: Dynamic Spread Thresholds Instead of a fixed 3% threshold, the bot now calculated the **minimum profitable spread** dynamically based on current fee levels and expected slippage. This unlocked more trading opportunities at tighter spreads. ### Improvement 3: Position Sizing via Kelly Criterion The trader adopted a modified **Kelly Criterion** for position sizing, capping any single trade at 8% of total capital. This prevented one bad leg-risk event from materially damaging the portfolio. Month two results: **$6,140 net profit** on the same $10,000 base — a 61.4% return in 30 days. At this point, the trader raised capital to $25,000 and continued scaling. It's worth comparing this strategy to other systematic approaches — the [swing trading risk analysis on real prediction outcomes](/blog/swing-trading-risk-analysis-real-prediction-outcomes-explained) shows how directional traders fare versus pure arbitrageurs over similar timeframes. --- ## Comparison: Manual vs. API-Based Arbitrage One of the most common questions is whether you even need a bot. Here's how manual and automated approaches compare: | Factor | Manual Arbitrage | API Bot Arbitrage | |---|---|---| | Speed of execution | 30–120 seconds | < 500 milliseconds | | Opportunities captured per day | 1–3 | 10–30 | | Leg risk exposure | Very high | Manageable | | Setup cost | ~$0 | $50–$500 | | Ongoing time commitment | 4–6 hours/day | 30 min/week (monitoring) | | Scalability | Limited | High | | Emotional trading risk | High | None | | Suitable for beginners | Yes (start here) | Intermediate/Advanced | The data is clear: API automation doesn't just save time — it fundamentally changes your **risk profile** by compressing the window between leg executions. Humans simply can't compete with a well-configured bot on time-sensitive spreads. --- ## Key Lessons from the Case Study After analyzing the full 60-day run, here are the most important takeaways: 1. **Start with paper trading** — run your bot in simulation mode for at least two weeks before going live 2. **Log everything** — every API call, every trade, every error; you'll need this data to improve 3. **Don't over-optimize early** — the first bot was simple and still made money; complexity came later 4. **Regulatory awareness matters** — Kalshi is CFTC-regulated; understand the tax and compliance implications in your jurisdiction 5. **Liquidity is your ceiling** — thin markets cap your position size; the real constraint isn't finding spreads, it's deploying enough capital to matter 6. **Expect platform outages** — both APIs went down during high-traffic events; build retry logic and circuit breakers For traders interested in applying similar systematic thinking to political event markets, [advanced political prediction market strategies](/blog/advanced-political-prediction-market-strategies-with-predictengine) covers how to layer directional views on top of arbitrage structures. --- ## Frequently Asked Questions ## Is prediction market arbitrage actually risk-free? No — it's **near** risk-free, but not completely. The main risks are leg risk (one side fills at a bad price), platform outages, and sudden liquidity withdrawal. In the case study, 4 out of 47 trades resulted in losses precisely because of these factors. ## How much capital do you need to start API arbitrage? You can technically start with as little as **$500–$1,000**, but meaningful profits require at least $5,000–$10,000. Spreads of 3–5% on a $500 position generate only $15–$25 per trade, which can be wiped out by a single slippage event or platform fee change. ## Do I need to know how to code to run an arbitrage bot? **Basic Python knowledge** is sufficient to get started. The core logic — fetch prices, compare, execute — can be written in under 200 lines of code. Platforms like [PredictEngine](/) also offer API tooling that reduces the amount of custom code required for common arbitrage workflows. ## Which prediction market platforms have the best APIs? **Kalshi** and **Polymarket** are the two most commonly used for arbitrage due to their liquidity and documentation quality. Kalshi's REST API is particularly developer-friendly. Manifold Markets is useful for testing but lacks the liquidity depth for serious arbitrage. Always check current API rate limits before building your strategy. ## How are prediction market arbitrage profits taxed? In the U.S., profits from prediction market trading are generally treated as **ordinary income** or capital gains depending on your holding period and the platform's structure. Kalshi (as a regulated CFTC exchange) may have specific reporting requirements. Always consult a qualified tax professional — this is not tax advice. ## Can a bot run arbitrage on sports prediction markets too? Yes, and some traders specifically target **sports event markets** because they generate high volume and frequent mispricing around injury news, lineup changes, and live score updates. The tradeoff is that sports markets resolve quickly and have tighter windows for execution. See [PredictEngine's sports betting tools](/sports-betting) for more on automated sports market strategies. --- ## Start Automating Your Prediction Market Strategy The case study above isn't theoretical — it's a real playbook that generated nearly **$10,000 in net profit over 60 days** starting from a modest $10,000 base. The edge came not from secret information, but from **speed, consistency, and disciplined risk management** enabled by API automation. If you're ready to start building your own arbitrage system, [PredictEngine](/) gives you the market data feeds, execution tools, and analytics dashboard to get up and running faster than building from scratch. Whether you're a developer looking for clean API access or a trader who wants pre-built bot frameworks, PredictEngine has the infrastructure to support your strategy. Explore the [platform pricing](/pricing) and start your free trial today — because every day you wait, someone else's bot is capturing the spread you're missing.

Ready to Start Trading?

PredictEngine lets you create automated trading bots for Polymarket in seconds. No coding required.

Get Started Free

Continue Reading