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.
The lighter.dex.order_books table provides flattened order book updates. One row per market/update/side/level.
Table Details
| Property | Value |
|---|
| Clustering Key(s) | to_date("timestamp") (base table) |
Table Columns
| Column Name | Description |
|---|
| market_id | Lighter market ID |
| symbol | Market symbol (e.g., BTC, ETH/USDC) |
| market_type | ’perpetuals’ or ‘spot’ |
| base_symbol | Base asset symbol |
| quote_symbol | Quote asset symbol |
| collateral_symbol | Collateral asset symbol for perpetuals. NULL for spots |
| base_l1_address | L1 contract address of the base asset. NULL for perpetuals |
Order Book Data
| Column Name | Description |
|---|
| timestamp | UTC timestamp of the order book update |
| side | ’ask’ or ‘bid’ |
| level | 0-based index within the ask or bid array |
| price | Price at this level in quote asset units |
| size | Size at this level in base asset units |
| usd_amount | Dollar value at this level (price * size) |
| Column Name | Description |
|---|
| nonce | Global sequence number at update time |
| begin_nonce | Sequence number at the start of the batch |
| book_offset | Per-market incrementing version counter |
Sample Query
The underlying data is clustered by to_date("timestamp"). Filter by date for efficient queries. Example using the raw table (same clustering applies when querying the view):
SELECT
market_id,
timestamp,
nonce,
asks,
bids
FROM lighter.raw.order_books
WHERE timestamp >= CURRENT_DATE
ORDER BY timestamp DESC
LIMIT 100
To query the flattened view lighter.dex.order_books (symbol, side, level, price, size, usd_amount), use the same date filter: WHERE timestamp >= CURRENT_DATE (and optionally AND symbol = 'BTC').