The Bot Ledger
EN

Home / Guides

Predict.fun API Guide: Connect a Trading Bot in 5 Steps

Predict.fun API for a bot: auth, listing 5-minute markets, the ladder, taker orders, fills, and the settlement rule that differs from the rest.

A dark blue circuit board, close up
Photo: Vishnu Mohanan, Unsplash
Auth
API key issued in the account settings, sent as a header.
Read
REST for markets and ladders; a book stream for live updates.
Trade
Limit and taker orders per share, tick 0.01.
Taker fee
0.018 x min(p, 1-p) per share, charged in outcome shares. Makers pay nothing.
Settlement
A point read of the oracle price at each boundary. No averaging. Ties pay 50/50.
Geography
Blocks the US.
Docs
docs.predict.fun

Five steps, simplified. Endpoint names below are placeholders for the shape of each call; take the exact paths from the reference, which changes more often than the larger exchanges.

  1. Authenticate

    import requests
    BASE = "https://api.predict.fun"          # confirm in the docs
    H = {"X-API-Key": API_KEY}
  2. List the current windows

    markets = requests.get(f"{BASE}/markets", params={"category": "crypto", "status": "open"}, headers=H).json()
    m = next(x for x in markets if x["timeframe"] == "5m" and x["asset"] == "BTC")
    start_price = m["startPrice"]              # the declared open, exact to the tick

    Windows chain: the end price of one window is the start price of the next. If your own spot feed disagrees with the declared start price, trust the declared one.

  3. Read the ladder

    book = requests.get(f"{BASE}/markets/{m['id']}/orderbook", headers=H).json()
    best_ask = book["asks"][0]                 # [price, size]
    best_bid = book["bids"][0]

    In the last minute almost every print lifts the offer or hits the bid; nothing trades inside the spread. Model your fills at the touch, not the mid.

  4. Place a taker buy

    order = {"marketId": m["id"], "outcome": "UP", "side": "BUY", "type": "LIMIT",
             "price": best_ask[0], "size": 30, "timeInForce": "FOK"}
    r = requests.post(f"{BASE}/orders", json=order, headers=H).json()

    The fee comes out of the shares you receive, so a 30-share buy at 50 cents delivers about 29.7 shares.

  5. Read fills

    fills = requests.get(f"{BASE}/fills", headers=H).json()

Settlement is the difference

Polymarket, Limitless and Kalshi all settle short crypto markets on an average over the last minute. Predict.fun settles on a single read. On flat windows the two rules disagree about one time in ten, so do not pool Predict.fun outcomes with the others, and do not carry a model trained on the others across without retraining.