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

# Orderbook

> High-freshness orderbook snapshots for Kalshi perpetual markets, with bid and ask price levels.

The `common.perpetuals.kalshi_orderbook` table provides high-freshness orderbook snapshots for Kalshi perpetual markets. Each row captures the full bid and ask ladders for a market at a point in time.

Use this table for liquidity analysis, spread monitoring, and market-depth assessment.

### Table Columns

**Data Notes:**

* One row per market per snapshot (`snapshot_ts`).
* `bids` and `asks` are arrays of `[price, quantity]` levels, with prices per contract in US dollars.
* `underlying_bids` and `underlying_asks` are the same ladders with prices converted to the underlying asset (`price / contract_size`); quantities are unchanged.

Unique Key: `unique_key`

| Column Name      | Data Type         | Description                                                                     |
| ---------------- | ----------------- | ------------------------------------------------------------------------------- |
| project          | VARCHAR           | Project identifier, always 'kalshi'.                                            |
| protocol         | VARCHAR           | Protocol identifier, always 'kalshi'.                                           |
| unique\_key      | VARCHAR           | Unique identifier for the orderbook snapshot.                                   |
| market\_ticker   | VARCHAR           | Perp market ticker.                                                             |
| snapshot\_ts     | TIMESTAMP\_NTZ(9) | Snapshot timestamp.                                                             |
| contract\_size   | FLOAT             | Units of the underlying asset represented by one contract.                      |
| bids             | ARRAY             | Bid levels as an array of \[price, quantity] entries (price per contract, USD). |
| asks             | ARRAY             | Ask levels as an array of \[price, quantity] entries (price per contract, USD). |
| underlying\_bids | ARRAY             | Bid levels with prices converted to the underlying asset (USD).                 |
| underlying\_asks | ARRAY             | Ask levels with prices converted to the underlying asset (USD).                 |
| bids\_depth      | NUMBER            | Number of bid levels in the snapshot.                                           |
| asks\_depth      | NUMBER            | Number of ask levels in the snapshot.                                           |
| partition\_date  | DATE              | Snapshot date (used for partitioning).                                          |
| ingested\_at     | TIMESTAMP\_NTZ(9) | Timestamp the record was ingested into Allium's database.                       |

***

### Sample Query

```sql theme={null}
select
  market_ticker,
  snapshot_ts,
  bids_depth,
  asks_depth,
  bids[0] as best_bid,
  asks[0] as best_ask
from common.perpetuals.kalshi_orderbook
where market_ticker = 'KXBTCPERP'
  and partition_date >= current_date - interval '1 day'
order by snapshot_ts desc
limit 100
```
