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

# Full Orderbook

> Kalshi full order book event stream

## Overview

Full order book event stream with individual price-level updates and periodic snapshots. Each row is either a price-level update or a full snapshot, distinguished by the `message_type` column. Available as both **CSV** (gzip-compressed) and **Parquet** (zstd-compressed).

## Columns

| <div style={{minWidth: '240px'}}>Column</div> | CSV type | Parquet type                 | Description                                     |
| --------------------------------------------- | -------- | ---------------------------- | ----------------------------------------------- |
| `exchange`                                    | string   | string                       | Always `kalshi`                                 |
| `ticker`                                      | string   | string                       | Market ticker                                   |
| `local_timestamp`                             | integer  | int64                        | Capture timestamp (nanoseconds since epoch)     |
| `exchange_timestamp`                          | string   | timestamp\_micros (nullable) | Exchange timestamp                              |
| `message_type`                                | string   | string                       | `price_level_update` or `snapshot`              |
| `price_level_update_price`                    | decimal  | float64 (nullable)           | Price level (update rows only)                  |
| `price_level_update_quantity`                 | decimal  | float64 (nullable)           | New quantity at this level (update rows only)   |
| `price_level_update_side`                     | string   | string (nullable)            | `bid` or `ask` (update rows only)               |
| `snapshot_bid_prices`                         | string   | string (nullable)            | Comma-separated bid prices (snapshot rows only) |
| `snapshot_bid_sizes`                          | string   | string (nullable)            | Comma-separated bid sizes (snapshot rows only)  |
| `snapshot_ask_prices`                         | string   | string (nullable)            | Comma-separated ask prices (snapshot rows only) |
| `snapshot_ask_sizes`                          | string   | string (nullable)            | Comma-separated ask sizes (snapshot rows only)  |

## Fetching Data

Use the `path` from the [list response](/datasets/kalshi/available-files#finding-exports-for-a-ticker). The download endpoint returns a **302 redirect** to a signed URL; follow it with `curl -L` or equivalent.

<CodeGroup>
  ```python Python theme={null}
  import requests

  def download_complete(path, api_key):
      url = f"https://api.predictiondata.dev/v2/datasets{path}"
      headers = {"x-auth-token": api_key}

      response = requests.get(url, headers=headers, allow_redirects=True)
      response.raise_for_status()

      filename = path.split("/")[-1]
      with open(filename, "wb") as f:
          f.write(response.content)

      print(f"Downloaded to {filename}")

  if __name__ == "__main__":
      api_key = "YOUR_API_KEY"
      path = "/kalshi/KXSB-26-NE/complete/2026-02-03.csv.gz"

      download_complete(path, api_key)
  ```

  ```javascript Node.js theme={null}
  const axios = require('axios');
  const fs = require('fs');

  async function downloadComplete(path, apiKey) {
      const url = `https://api.predictiondata.dev/v2/datasets${path}`;

      const response = await axios.get(url, {
          headers: { 'x-auth-token': apiKey },
          responseType: 'arraybuffer'
      });

      const filename = path.split('/').pop();
      fs.writeFileSync(filename, response.data);
      console.log(`Downloaded to ${filename}`);
  }

  (async () => {
      const apiKey = "YOUR_API_KEY";
      const path = "/kalshi/KXSB-26-NE/complete/2026-02-03.csv.gz";

      try {
          await downloadComplete(path, apiKey);
      } catch (error) {
          console.error("Error downloading data:", error.message);
      }
  })();
  ```

  ```bash cURL theme={null}
  curl -L -H "x-auth-token: YOUR_API_KEY" \
    "https://api.predictiondata.dev/v2/datasets/kalshi/KXSB-26-NE/complete/2026-02-03.csv.gz" \
    --output complete.csv.gz
  ```
</CodeGroup>

## Notes

* Each row is either a `price_level_update` (one level changed) or a `snapshot` (full book state). Columns for the other type will be null.
* The orderbook is the **YES orderbook**. Bids are the raw YES bids from Kalshi. Asks are calculated by taking `1 - price` of the NO bids. If you need the raw, unconverted data, contact [calder@predictiondata.dev](mailto:calder@predictiondata.dev).
* Prices and quantities are rounded to 4 decimal places.
* `local_timestamp` is nanoseconds since Unix epoch (when our servers captured the message).
* `exchange_timestamp` is when the event occurred on Kalshi. It is null for orderbook snapshots. In CSV it is an RFC 3339 string; in Parquet it is stored as `TimestampMicros`.
* Each export covers one UTC day (00:00:00 to 23:59:59).
