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

# Trades

> Raw trade data from Lighter

The `lighter.raw.trades` table contains raw trade data from Lighter.

### Table Details

| Property          | Value                  |
| ----------------- | ---------------------- |
| Clustering Key(s) | `to_date("timestamp")` |

## Table Columns

| Column Name                    | Description                                         |
| ------------------------------ | --------------------------------------------------- |
| trade\_id                      | Unique identifier for the trade                     |
| tx\_hash                       | On-chain transaction hash                           |
| type                           | Trade type: 'trade', 'liquidation', or 'deleverage' |
| market\_id                     | Market this trade belongs to                        |
| size                           | Trade size in base asset units                      |
| price                          | Execution price                                     |
| usd\_amount                    | USD value                                           |
| ask\_account\_id               | Account ID of the ask (sell) side                   |
| bid\_account\_id               | Account ID of the bid (buy) side                    |
| ask\_id                        | Order ID of the ask side                            |
| bid\_id                        | Order ID of the bid side                            |
| ask\_client\_id                | Client-assigned order ID for ask side               |
| bid\_client\_id                | Client-assigned order ID for bid side               |
| is\_maker\_ask                 | True if the maker is on the ask side                |
| block\_height                  | Block height of the trade                           |
| timestamp                      | UTC timestamp of the trade                          |
| maker\_fee                     | Maker fee in ppm                                    |
| taker\_fee                     | Taker fee in ppm                                    |
| taker\_position\_size\_before  | Taker's position size before this trade             |
| maker\_position\_size\_before  | Maker's position size before this trade             |
| taker\_position\_sign\_changed | Whether taker's position sign changed               |
| maker\_position\_sign\_changed | Whether maker's position sign changed               |

## Sample Query

```sql theme={null}
SELECT
    trade_id,
    timestamp,
    market_id,
    type,
    size,
    price,
    usd_amount
FROM lighter.raw.trades
WHERE timestamp >= CURRENT_DATE - 1
ORDER BY timestamp DESC
LIMIT 100
```
