lighter.dex.trades table contains all DEX trades on Lighter including voluntary trades, liquidations, and deleverages. Use trade_type to filter by event type.
Table Details
| Property | Value |
|---|---|
| Clustering Key(s) | to_date("timestamp") (base table) |
Table Columns
Trade Type
| Column Name | Description |
|---|---|
| trade_type | Type of trade event: ‘trade’, ‘liquidation’, or ‘deleverage’ |
| market_type | ’perpetuals’ or ‘spot’ |
Market Information
| Column Name | Description |
|---|---|
| coin | Market symbol (e.g., BTC, ETH/USDC) |
| token_a_symbol | Base token symbol |
| token_b_symbol | Quote token symbol |
| market_id | Lighter market ID |
| max_leverage | Maximum leverage for this market |
Trade Details
| Column Name | Description |
|---|---|
| amount | Trade size in base asset units |
| price | Execution price |
| usd_amount | USD value of the trade |
| timestamp | UTC timestamp of the trade |
| transaction_hash | On-chain transaction hash |
| trade_id | Unique trade identifier |
| unique_id | Alias of trade_id |
| block_height | Block height of the trade |
Participants
| Column Name | Description |
|---|---|
| buyer | Account ID of the buyer (bid side) |
| seller | Account ID of the seller (ask side) |
| maker_account_id | Account ID of the maker |
| taker_account_id | Account ID of the taker |
| is_maker_ask | True if the maker is on the ask (sell) side |
Order Information
| Column Name | Description |
|---|---|
| buyer_order_id | Order ID of the buyer’s order |
| seller_order_id | Order ID of the seller’s order |
| buyer_client_id | Client-assigned order ID for buyer |
| seller_client_id | Client-assigned order ID for seller |
Fees
| Column Name | Description |
|---|---|
| fee_token | Token in which fees are paid |
| buyer_fee | Fee paid by buyer in USD |
| seller_fee | Fee paid by seller in USD |
| maker_fee_rate | Maker fee as decimal fraction |
| maker_fee_amount | Maker fee in USD |
| taker_fee_rate | Taker fee as decimal fraction |
| taker_fee_amount | Taker fee in USD |
Position Changes
| Column Name | Description |
|---|---|
| buyer_start_position | Buyer’s position size before this trade |
| seller_start_position | Seller’s position size before this trade |
| buyer_position_sign_changed | Whether buyer’s position flipped direction |
| seller_position_sign_changed | Whether seller’s position flipped direction |
Liquidation Fields
| Column Name | Description |
|---|---|
| liquidated_account_id | Account ID of the liquidated party. NULL for regular trades |
| counterparty_account_id | Account ID of the counterparty. NULL for regular trades |
| liquidation_fee_rate | Liquidation fee rate. NULL for regular trades |
| liquidation_fee_amount | Liquidation fee in USD. NULL for regular trades |
| liquidated_max_leverage | Liquidated account’s max leverage. NULL for regular trades |
Market Parameters
| Column Name | Description |
|---|---|
| collateral_symbol | Collateral asset symbol (e.g., USDC) |
| maintenance_margin_fraction | Market maintenance margin fraction |
| closeout_margin_fraction | Market closeout margin fraction |