> ## 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.

# Query Kalshi and Polymarket market data

> Query Kalshi and Polymarket markets, trades, candles, orderbooks, and wallet analytics with the Solana Tracker Prediction Markets API.

Use the Prediction Markets API for Kalshi and Polymarket data. Start by finding a market and its exchange-specific ID, then request history, prices, books, or wallet analytics.

<Note>
  **Public Beta** — Unified Kalshi + Polymarket market data with full history. Join [Discord](https://discord.gg/JH2e9rR9fc) for support.
</Note>

<Info>
  **Base URL:** `https://prediction-market-api.solanatracker.io`\
  **Auth:** `x-api-key: YOUR_API_KEY` (same Data API key)\
  **Realtime:** [Datastream prediction rooms](/guides/datastream-prediction-markets)
</Info>

## First request

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

  ```javascript JavaScript theme={null}
  const res = await fetch(
    "https://prediction-market-api.solanatracker.io/v1/markets/trending?limit=5",
    { headers: { "x-api-key": "YOUR_API_KEY" } }
  );
  const data = await res.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  res = requests.get(
      "https://prediction-market-api.solanatracker.io/v1/markets/trending",
      params={"limit": 5},
      headers={"x-api-key": "YOUR_API_KEY"},
  )
  print(res.json())
  ```
</CodeGroup>

## Exchanges

Set `exchange` on endpoints that support it. `poly` is an alias for `polymarket`.

| Value | Platform |
| - | - |
| `kalshi` | Kalshi |
| `polymarket` / `poly` | Polymarket |
| omit | Both (where supported) |

## Discover markets

| Endpoint | Use for |
| - | - |
| `GET /v1/markets/trending` | Hot markets |
| `GET /v1/markets/new` | Recently listed |
| `GET /v1/markets/search` | Text by text |
| `GET /v1/browse` | Browse / filter |
| `GET /v1/events` | Event groupings with nested markets |
| `GET /v1/categories`, `/v1/series`, `/v1/sports` | Taxonomy |

```bash theme={null}
curl "https://prediction-market-api.solanatracker.io/v1/markets/search?q=bitcoin&exchange=polymarket" \
  -H "x-api-key: YOUR_API_KEY"
```

Fetch a single market with the identifier expected by its exchange, or use a market slug:

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

curl "https://prediction-market-api.solanatracker.io/v1/markets/slug/{slug}" \
  -H "x-api-key: YOUR_API_KEY"
```

## Historical data

Use these endpoints for historical trades and candles:

| Endpoint | Returns |
| - | - |
| `GET /v1/markets/{ticker}/trades` | Trade tape for one market |
| `GET /v1/markets/trades` | Cross-market trades |
| `GET /v1/markets/{ticker}/candlesticks` | OHLCV for one market |
| `GET /v1/events/{event_id}/candlesticks` | Event-level candles |
| `GET /v1/markets/candlesticks/batch` | Batch candles |

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

## Live market state (REST)

| Endpoint | Returns |
| - | - |
| `GET /v1/markets/{ticker}/price` | Latest price |
| `GET /v1/markets/{ticker}/midpoint` | Mid |
| `GET /v1/markets/{ticker}/spread` | Spread |
| `GET /v1/markets/{ticker}/orderbook` | Full book |
| `GET /v1/markets/{ticker}/quote` | Size-aware VWAP ladder |
| `GET /v1/markets/books` | Batch books |

For continuous updates, subscribe on Datastream instead of polling — see the [realtime guide](/guides/datastream-prediction-markets).

## Crypto up/down (polymarket)

| Endpoint | Returns |
| - | - |
| `GET /v1/crypto/events` | Active / recent crypto windows |
| `GET /v1/crypto/price` | Live underlying |
| `GET /v1/crypto/price-history` | Historical underlying |
| `GET /v1/events/{event_id}/crypto` | Price-to-beat / final for a window |
| `GET /v1/crypto/traders` | Window traders |

Underlying Chainlink ticks also stream on `pm:crypto:{asset}` rooms. Outcome chance uses market price rooms (`pm:market:polymarket:{tokenId}:prices`).

## Wallet analytics (polymarket)

Kalshi has no public wallets. Polymarket account endpoints use an Ethereum address:

| Endpoint | Returns |
| - | - |
| `GET /v1/accounts/{address}/overview` | Summary |
| `GET /v1/accounts/{address}/positions` | Open positions |
| `GET /v1/accounts/{address}/closed-positions` | Closed / resolved |
| `GET /v1/accounts/{address}/pnl` | FIFO PnL |
| `GET /v1/accounts/{address}/pnl/chart` | PnL chart |
| `GET /v1/accounts/{address}/trades` | Fills |
| `GET /v1/accounts/{address}/activity` | Ledger activity |

Leaderboards: `GET /v1/leaderboard/pnl`, `GET /v1/leaderboard/traders`, plus event-scoped variants under `/v1/events/{event_id}/...`.

## Batch helpers

| Endpoint | Notes |
| - | - |
| `GET` / `POST /v1/markets/batch` | Many markets in one call |
| `GET /v1/events/batch` | Many events |
| `GET /v1/markets/candlesticks/batch` | Many candle series |
| `GET /v1/markets/books` | Many orderbooks |

## Next steps

<CardGroup cols={2}>
  <Card title="Product overview" href="/prediction-markets/overview">
    Scope, IDs, and conventions.
  </Card>

  <Card title="Live market data" href="/guides/datastream-prediction-markets">
    Live trades, prices, books, and volume rooms.
  </Card>
</CardGroup>
