// BLOG
Trading prediction markets, from a developer's seat.
APIs, execution quality, AI agents, and quant strategy on Kalshi and Polymarket. Written by the team building Mithril.
// PREDICTION-MARKET APIS
Kalshi and Polymarket from a developer's seat: auth, order placement, market data, and the differences that bite.
The complete guide to prediction market APIs (Kalshi + Polymarket)
How to trade Kalshi and Polymarket programmatically: auth, market data, order placement, rate limits, and the architectural differences between the two APIs.
Read →Kalshi API guide: place your first order
A practical walkthrough of the Kalshi trade API: API-key auth and request signing, markets and orderbook endpoints, placing your first order, and the gotchas.
Read →Polymarket CLOB API guide
How Polymarket's API actually works: Gamma vs CLOB services, L1/L2 auth, token_id vs condition_id, a py-clob-client walkthrough, and settlement on Polygon.
Read →Kalshi API vs Polymarket API: the differences that bite
A side-by-side of Kalshi and Polymarket APIs: auth, market IDs, price formats, fees, order lifecycle, rate limits, and error semantics — with a comparison table.
Read →How to build a prediction-market trading bot in Python
Architecture for a Python prediction-market bot: market data loop, signal-to-order pipeline, risk checks, and idempotent retries — venue-agnostic, with code.
Read →Rate limits, order types, and websockets on Kalshi and Polymarket
The operational layer of trading Kalshi and Polymarket: order types, WebSocket channels, rate limits, and the backoff patterns that keep your bot connected.
Read →Unified market IDs: mapping the same event across Kalshi and Polymarket
Kalshi tickers and Polymarket condition IDs share no common key. Why matching markets across venues is hard, where it goes wrong, and how unified IDs enable routing.
Read →// EXECUTION & FEES
What a fill actually costs: fee schedules, slippage in thin books, routing, and how to measure execution.
Execution quality in prediction markets: fees, slippage, and routing
The total cost of a fill on Kalshi and Polymarket: displayed price, fees, spread, and market impact — and how routing and order-working reduce it.
Read →Kalshi fees explained (with worked examples)
How Kalshi's taker fee formula 0.07 × price × (1−price) actually works: round-up rules, maker treatment, and worked examples at 10¢, 50¢, and 90¢.
Read →Polymarket fees and gas explained
Polymarket charges no exchange trading fee on most markets — but execution isn't free. Spread, price impact, Polygon gas, and USDC bridging, with a worked example.
Read →Kalshi vs Polymarket fees: the total cost of a fill
Side-by-side worked examples of Kalshi's taker fee vs Polymarket's fee-free-but-not-costless model — and when the displayed-cheaper venue is net-more-expensive.
Read →What is smart order routing? Applied to prediction markets
Smart order routing, translated from equities to Kalshi and Polymarket: net-price-after-fees comparison, split fills, and what to do with single-venue markets.
Read →Slippage in thin prediction markets and how to avoid it
Why market orders in thin Kalshi and Polymarket books cost more than any fee — and how slicing, pacing, passive posting, and slippage caps contain it.
Read →Execution receipts: what best execution means in prediction markets
Best execution, imported from tradfi: arrival-mid benchmarks, naive-sweep comparisons, and fee itemization — why every prediction-market fill deserves a receipt.
Read →// AI AGENTS THAT TRADE
Letting Claude, GPT, or your own agent trade prediction markets — with custody and risk limits done right.
How to let an AI agent trade prediction markets safely
AI agents can trade Kalshi and Polymarket — but custody, runaway orders, and hallucinated trades will hurt you first. The architecture that prevents all three.
Read →Trading Kalshi and Polymarket with Claude via MCP (tutorial)
Step-by-step: connect Claude to a hosted MCP trading server, set hard risk limits first, then search markets and place orders on Kalshi and Polymarket from chat.
Read →What is an MCP server? A trader's explanation
MCP is the protocol that lets AI models call trading tools directly. What tools and resources are, why MCP beat bespoke plugins, and hosted vs local servers.
Read →Risk limits for AI trading agents: why hard server-side caps
Prompt instructions are not risk controls. The server-side limit stack an AI trading agent needs: notional caps, per-market limits, slippage bounds, kill switch.
Read →Agent custody: why your AI agent should never hold your keys
API keys in an LLM's environment are one prompt injection from gone. How envelope encryption (X25519) and decrypt-only-to-sign custody keep agents trading without keys.
Read →Building a prediction-market bot with Claude Code (walkthrough)
Using an AI coding agent to build a Kalshi/Polymarket bot: project setup, iterating on strategy code, sandbox testing, and the guardrails that keep it honest.
Read →// QUANT STRATEGIES
Arbitrage, market making, sizing, and backtesting on binary contracts.
Quantitative trading on prediction markets: a field guide
Market structure, edge sources, data, backtesting, and execution for quants trading Kalshi and Polymarket — plus how prediction markets differ from options and sportsbooks.
Read →Cross-venue arbitrage between Kalshi and Polymarket
The same event often trades at different prices on Kalshi and Polymarket. How the arb works, the fee and resolution traps that eat it, and a worked example.
Read →Market making on prediction markets 101
How to quote both sides of a binary contract: spread capture math, inventory risk, Kalshi's maker fee advantage, and adverse selection near news and resolution.
Read →Position sizing on binary contracts: Kelly and its discounts
The Kelly formula for binary prediction-market contracts with a worked example — plus why fractional Kelly, correlation adjustments, and hard caps are non-negotiable.
Read →