How to build a Polymarket or Kalshi bot (with one API for both)

Updated 2026-10-12

A prediction market bot needs four things: prices from both venues, each venue's fees, a check that two "matching" markets really settle the same way, and order execution. The first three are the hard part and they are what MarketMaster's API returns in one call. Execution stays with each venue's own trading API, using your own account, so your keys and funds never pass through anyone else.

1. Get a free API key

Create an account and copy your key from the dashboard. It looks like mmk_live_.... The free tier is 1,000 requests a month, enough to build and test. A bot that polls once a minute needs about 43,000 a month, which is the API Starter plan ($9.99/month, 50,000 requests).

2. Pull edges for both venues in one request

This is a complete working example. Set MARKETMASTER_API_KEY in your environment and run it:

import os, requests

API = "https://api.marketmaster.live/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['MARKETMASTER_API_KEY']}"}

r = requests.get(f"{API}/edges", params={"limit": 100}, headers=HEADERS, timeout=20)
r.raise_for_status()

for e in r.json()["edges"]:
    # Only act on edges that survive the venue's fee AND whose cross-venue
    # pair was machine-checked to settle on the same terms.
    if e["edge_after_fees"] > 1 and e["settlement_risk"] == "aligned":
        print(f'{e["platform"]:10} {e["outcome"]:3} ask {e["ask"]:.2f}  '
              f'+{e["edge_after_fees"]:.1f} pts after fees  {e["market_title"][:60]}')

The same data is available from the JavaScript and Python SDKs (npm install @marketmaster/sdk, pip install marketmaster), over WebSocket for push updates, and through an MCP server if your bot is an AI agent in Claude or Cursor.

What each field means

FieldWhat it tells your bot
platform, market_idWhich venue and contract the edge is on, in that venue's own id format, so you can place the order directly.
price, askLast price and the ask you would actually pay, as probabilities from 0 to 1.
fair_valueMarketMaster's model probability, built from both venues' books.
edge_at_askFair value minus the ask, in percentage points.
fee_per_contract, edge_after_feesThe venue's taker fee at that price, and the edge left after paying it. Most raw edges go negative here.
settlement_riskaligned, divergent or unverified: whether the matched contracts on the two venues settle on the same source, deadline and wording.
confidence, match_qualityHow much to trust the number: liquidity, how closely the venues agree, and how good the cross-venue match is.

3. Place orders with each venue's trading API

Kalshi and Polymarket both offer trading APIs for automated orders on your own account: Kalshi's REST and WebSocket API at docs.kalshi.com, and Polymarket's order-book (CLOB) API at docs.polymarket.com. Read each venue's rules on automated trading and rate limits first, and start with small size: an order that fills at a worse price than the ask you saw is the normal way a bot loses money.

Why most bot strategies lose to fees and settlement

Common questions

Is there a Polymarket bot that trades for me?

MarketMaster doesn't place trades; it's read-only data. Your bot places orders through the venue's own API with your own account.

Can I use one API for Kalshi and Polymarket?

For market data, yes: MarketMaster normalizes both into one schema and matches the same event across them. For placing orders you use each venue's API separately.

How much does it cost?

Free for 1,000 requests a month. API Starter is $9.99/month for 50,000 requests and API Pro $29.99/month for 1,000,000. See the developer docs for every endpoint.

Get a free API key See today's edges in the scanner