Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.predexon.com/llms.txt

Use this file to discover all available pages before exploring further.

You’re here to find edges in prediction-market data. This guide gets you from API key to a runnable backtest, then points you at the deeper material. You’ll be ready to:
  • Pull historical orderbook + trade + candle data for any market
  • Reconstruct any wallet’s full position history and P&L
  • Build smart-money signals from the leaderboard endpoint
  • Stream live signals (trades, pending trades, orderbook) over WebSocket

10 minutes to a backtest

Goal: pull 30 days of orderbook snapshots for the highest-volume open market, plus the trade tape, plus the candle series — enough to run a real backtest.
import os, requests, pandas as pd, time

API_KEY = os.environ["PREDEXON_API_KEY"]
BASE = "https://api.predexon.com"
HEADERS = {"x-api-key": API_KEY}

# 1. Find the highest-volume open market
top = requests.get(
    f"{BASE}/v2/polymarket/markets",
    headers=HEADERS,
    params={"status": "open", "sort": "volume", "limit": 1},
).json()["markets"][0]

condition_id = top["condition_id"]
token_id = top["outcomes"][0]["token_id"]  # "Yes" side
print(f"Backtesting: {top['title']}")

# 2. Pull 30 days of hourly candles (seconds for candles)
end_s = int(time.time())
start_s = end_s - 30 * 24 * 3600
candles = requests.get(
    f"{BASE}/v2/polymarket/candlesticks/{condition_id}",
    headers=HEADERS,
    params={"interval": 60, "start_time": start_s, "end_time": end_s},
).json()
candles_df = pd.DataFrame(candles)
print(f"Candles: {len(candles_df)} bars")

# 3. Pull the trade tape (seconds for trades)
trades = requests.get(
    f"{BASE}/v2/polymarket/trades",
    headers=HEADERS,
    params={"token_id": token_id, "start_time": start_s, "end_time": end_s, "limit": 1000},
).json()
print(f"Trades: {len(trades)}")

# 4. Walk historical orderbook snapshots (milliseconds for orderbook)
end_ms = end_s * 1000
start_ms = start_s * 1000
snapshots, cursor = [], start_ms
while cursor < end_ms:
    page = requests.get(
        f"{BASE}/v2/polymarket/orderbooks",
        headers=HEADERS,
        params={"token_id": token_id, "start_time": cursor, "end_time": end_ms, "limit": 200},
    ).json()
    if not page: break
    snapshots.extend(page)
    cursor = page[-1]["timestamp"] + 1
print(f"Orderbook snapshots: {len(snapshots)}")
That’s three free endpoints, no rate-limit risk, ~30 lines of code, ready for pandas/numpy/whatever your strategy framework is.
Every endpoint used here is free and unlimited. Run as many backtests as you want.

The data tools quants reach for first

Orderbook history

Per-token L2 snapshots from Jan 1 2026. Simulate fills against the real book — see Orderbook Replay for the pattern.

Candlesticks

OHLCV at 1m / 5m / 15m / 1h / 4h / 1d. By condition (market-level) or per-token (each outcome). Pair with trades for VWAP reconciliation.

Trade tape

Every fill on Polymarket, Kalshi, and Dflow. Filter by token, wallet, time range. Ground truth for execution simulation.

Wallet P&L

Realized + unrealized P&L time series for any wallet. The basis for smart-money cohort backtests.

Smart money for a market

Net positioning of profitable wallets in any market right now. Great for confirmation signals.

Leaderboards

Top wallets globally or per-market, sortable by realized profit, ROI, volume, or win rate.

Cross-venue matching

Find the same outcome on multiple venues — the basis of every cross-venue arb strategy.

Pending-trade signals (WS)

Mempool detection of fills 3–5 seconds before they confirm. Used by latency-sensitive strategies.

Backtesting walkthroughs

Three production-grade patterns we’ve written up:

Orderbook replay

Simulate fills against historical L2 state. The gold-standard for capacity-sensitive strategies.

Candle + trade reconciliation

Fast candle-driven backtests with trade-tape validation. Pass 1 is cheap; pass 2 keeps you honest.

Signal backtesting

How to honestly test smart-money, top-holders, and pending-trade signals before sizing into them.

Going live

Once a strategy backtests well, swap REST polling for WebSocket streams using the same data shapes.
What you backtested withWhat you stream live with
GET /v2/polymarket/tradesWS trades channel
GET /v2/polymarket/orderbooks (snapshots)WS orderbook channel (snapshots + deltas)
GET /v2/polymarket/activityWS activity channel
Pending-trade replay (not available historically)WS pending-trades
Read WebSocket Overview for connection patterns, subscription limits, and reconnect handling.

Common quant recipes

Detect smart-money entry

Wallet leaderboard + smart-money endpoint + alert path.

Cross-venue arbitrage

Matched pairs + router quote + two-leg fill.

Front-run from pending trades

Mempool WS + size + execute before confirmation.

Copy-trade a wallet

Subscribe wallet → mirror trade via router. End-to-end.

Data & Signals overview

Full map of every data endpoint, organized by utility.

Best Practices

Pagination, retries, rate-limit handling, WebSocket reconnect logic.