LoginContact us

Blog
Prediction Market APIPolymarket

Prediction Markets

Production-grade Polymarket data — markets, prices, activity, and P&L — through a single HTTP API

Power AI trading backtests, copy-trading apps, and portfolio dashboards with on-chain Polygon data enriched with Polymarket metadata. Part of the Token API.

  • Read-only REST endpoints covering markets, OHLCV, open interest, activity, positions, and platform aggregates
  • On-chain event data from Polygon, enriched with Polymarket scraper metadata
  • Scales from one-off research scripts to always-on trading agents

What you get with the Prediction Markets API

REST endpoints

Markets, OHLCV, OI, activity, positions, platform, users

Polygon on-chain

Trades, splits, merges, redemptions — at the tx level

Per-user P&L

Realized and unrealized PNL, cost basis, current price

Hourly refresh

Aggregated leaderboards updated continuously

How teams use it

Three patterns we see most often. Each uses a small subset of the endpoints — you can mix them as needed.

01

AI Trading Backtesting

Replay historical price action per outcome token and stress-test strategies against real liquidity events. Combine OHLCV with the activity feed to reconstruct fills and fees bar-by-bar.

  • GET/v1/polymarket/markets/ohlc
  • GET/v1/polymarket/markets/activity
Sample response
[
  {
    "timestamp": "2026-04-01 00:00:00",
    "open": 0.997,
    "high": 0.998,
    "low": 0.997,
    "close": 0.998,
    "volume": 295143.37,
    "trades": 1206,
    "buys": 498,
    "sells": 708,
    "unique_makers": 592,
    "unique_takers": 121,
    "total_fees": 0,
    "fee_count": 0,
    "effective_fee_rate": 0,
    "market": {
      "condition_id": "0x6331a779482df72d904c3c1e12b6409ff836bc06f8c97945cba9b25ada2c605c",
      "market_slug": "will-the-portland-trail-blazers-win-the-2026-nba-finals",
      "token_id": "48262548906086150698299934962091284390063927164151224719187427455086357699251",
      "outcome_label": "No",
      "closed": false
    }
  }
]

02

Copy Trading

Watch the top traders from the user leaderboard and mirror their entries and exits. The activity feed emits every trade, split, merge, and redemption with block-level timing so you can react in near real-time.

  • GET/v1/polymarket/users
  • GET/v1/polymarket/markets/activity
Sample response
[
  {
    "event_type": "trade",
    "timestamp": "2026-04-02 16:51:31",
    "block_num": 85014327,
    "tx_hash": "0xf190865afd395e2f4b8f2e5f8ceb2c05a86d94a73ea411e8a8a3fc649924c420",
    "user": "0x38e598961dd0456a7fb2e758bd433d3e59fb8a4a",
    "amount": "3976744",
    "value": 3.98,
    "fee_amount": "526315",
    "fee_value": 0.53,
    "market": {
      "condition_id": "0xcb37916b953e6b37a5be32ceabc5a093614be15d9e6abb7668bf6400fbf36d46",
      "market_slug": "bitcoin-up-or-down-on-april-3-2026",
      "token_id": "3861173442961229042274748637211736540847931193208187121747580704941582603312",
      "outcome_label": "Down",
      "closed": false
    }
  }
]

03

User Portfolio P&L

Build wallet dashboards and tax exports that show what a user holds across every Polymarket outcome token — with cost basis, current price, and realized vs unrealized PNL.

  • GET/v1/polymarket/users/positions
  • GET/v1/polymarket/markets/positions
Sample response
[
  {
    "user": "0x38e598961dd0456a7fb2e758bd433d3e59fb8a4a",
    "buy_cost": 6438.35,
    "sell_revenue": 247.09,
    "realized_pnl": -6191.26,
    "unrealized_pnl": 9005.64,
    "total_pnl": 2814.38,
    "pnl_pct": -0.96,
    "net_position": 9096.61,
    "avg_price": 0.68,
    "current_price": 0.99,
    "position_value": 9005.64,
    "active": true,
    "buys": 693,
    "sells": 20,
    "transactions": 713,
    "market": {
      "condition_id": "0x59feadddd58e7821c086ee9f3dc4f544514b94ebd0e8d645a3c4d80ebdd354a2",
      "market_slug": "btc-updown-5m-1771359600",
      "token_id": "25362470215305294361999917933416973453076214567033270695579745712197481070383",
      "outcome_label": "Up",
      "closed": false
    }
  }
]

REST endpoints

See official docs: https://thegraph.com/docs/en/token-api/polymarket-markets/markets/

GET/v1/polymarket/marketsMarket lookup by condition_id, slug, or token_id. Discovery mode with sort / filter.
GET/v1/polymarket/markets/ohlcOHLCV + fees per outcome token. USD per share, USDC for volume and fees.
GET/v1/polymarket/markets/oiOpen-interest time-series. Tracks splits and merges that move USDC collateral.
GET/v1/polymarket/markets/activityTrades, splits, merges, and redemptions in chronological order.
GET/v1/polymarket/markets/positionsPer-token leaderboard — cost basis, PNL, shares held, current value.
GET/v1/polymarket/platformPlatform-wide volume, open interest, and fee aggregates.
GET/v1/polymarket/usersUser discovery and lookup with volume / PNL / transaction counts.
GET/v1/polymarket/users/positionsUser portfolio with PNL breakdown per outcome token.

How it works

Same pattern as the rest of the Token API — issue an API key, hit the endpoint, parse the JSON.

1

Request API credentials from Pinax

2

Pick the endpoint for your use case

3

Call it from your app, notebook, or MCP client

4

Ship your strategy, dashboard, or agent

Frequently Asked Questions

Prediction Markets

Join Our Newsletter

Signup today to learn about our beta programs for your chain.