> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanatracker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Prediction Markets Overview

> Beta unified API for Kalshi and Polymarket — markets, events, full historical trades and candlesticks, orderbooks, crypto windows, wallet analytics, and live Datastream rooms.

<Note>
  **Public Beta** — Kalshi and Polymarket coverage with full historical market data. APIs may change. Join [Discord](https://discord.gg/JH2e9rR9fc) for feedback and support.
</Note>

Unified, read-only prediction market data for **Kalshi** and **Polymarket** — browse events and markets, pull historical trades and candlesticks, stream live tape and books, and (on Polymarket) analyze wallet PnL and positions.

<Info>
  **Hosted API**

  * **REST:** `https://prediction-market-api.solanatracker.io`
  * **Realtime:** `wss://datastream.solanatracker.io/{apiKey}` — join `pm:*` rooms
  * **Auth:** Data API key in the `x-api-key` header (same key as the Solana Data API)
</Info>

<CardGroup cols={2}>
  <Card title="Getting started guide" icon="https://mintcdn.com/solanatracker/l0aXlX5jJ7xpUiwY/icons/hugeicons/book-open.svg?fit=max&auto=format&n=l0aXlX5jJ7xpUiwY&q=85&s=c657b9b7c4d3c1b7c614737467c02d00" iconType="duotone" href="/cn/guides/prediction-markets" width="24" height="24" data-path="icons/hugeicons/book-open.svg">
    Auth, exchanges, IDs, historical data, and copy-paste REST examples.
  </Card>

  <Card title="Datastream guide" icon="https://mintcdn.com/solanatracker/4PIKDaYde_747jyk/icons/hugeicons/radio.svg?fit=max&auto=format&n=4PIKDaYde_747jyk&q=85&s=3d831f22127d920a197c5ed9e009f7ee" iconType="duotone" href="/cn/guides/datastream-prediction-markets" width="24" height="24" data-path="icons/hugeicons/radio.svg">
    Join `pm:*` rooms on `wss://datastream.solanatracker.io/{apiKey}`.
  </Card>
</CardGroup>

Open **Prediction Markets** for the REST OpenAPI, and **Datastream → Prediction Markets** for the live room reference.

***

## What you get

| Area | Coverage |
| - | - |
| Exchanges | Kalshi and Polymarket (`exchange=kalshi\|polymarket\|poly`) |
| Discovery | Search, browse, trending, new markets, categories, series, sports |
| Market data | Prices, midpoint, spread, quote ladder, open interest, related markets |
| History | Full historical trades and candlesticks (per market and per event) |
| Books | Live orderbooks and batch book lookups |
| Crypto | Polymarket crypto up/down windows, Chainlink price-to-beat, price history |
| Wallets | Polymarket positions, activity, FIFO PnL, charts, closed positions |
| Leaderboards | Top traders / PnL (Polymarket; Kalshi has no public wallets) |
| Realtime | Trades, significant trades (≥ \$25 notional), prices, quotes, books, volume, lifecycle, resolution |

***

## Quick example

```bash theme={null}
curl "https://prediction-market-api.solanatracker.io/v1/markets/trending?limit=5" \
  -H "x-api-key: YOUR_API_KEY"
```

```bash theme={null}
curl "https://prediction-market-api.solanatracker.io/v1/markets/{ticker}/candlesticks?interval=1h" \
  -H "x-api-key: YOUR_API_KEY"
```

***

## Conventions

* Response bodies use **camelCase**.
* Query params are **snake\_case** (camelCase aliases accepted where noted).
* SWR endpoints may return `X-Cache: HIT | HIT-STALE | MISS`.
* Busy backends may return **503** with `SERVICE_BUSY` (not a rate-limit 429).
* This API is **read / market-data only** — no order placement.

***

## IDs that matter

| Exchange | Use in REST | Use in realtime rooms |
| - | - | - |
| Polymarket | Slug, condition id, or CLOB **token id** depending on endpoint | Decimal **CLOB token id** in `pm:market:polymarket:{tokenId}:*` |
| Kalshi | Market / event tickers (often uppercase in REST) | **Lowercase** tickers in room names |

Room segments are always lowercase. Event-scoped rooms accept slug **or** gamma / event ticker identities when present on the payload.
