facts.perp_trades: one row per leg of a perpetual fill.facts.order_book_trades: one row per leg of a spot or outcome-market fill.
trade_id is shared by both legs of one fill. Within a fill, (trader_address, crossed) picks out a leg. crossed is true on the taker’s leg: the trader who accepted an order that was already there. It is false on the maker’s leg: the trader whose order was sitting waiting. That pair also handles a self-trade, where one address is on both sides and the two legs differ only on crossed.
Tables
- Perp trades
- Order book trades
facts.perp_trades holds one row per leg of a perpetual fill, keyed by block_timestamp, perp_market_id, trade_id, trader_address and crossed.| Column | Type | Description |
|---|---|---|
block_timestamp | TIMESTAMP | Time of the block this trade landed in. |
block_number | INT64 | Number of that block. |
trade_id | INT64 | Identifier shared by both legs of the same fill. Part of the row key, alongside perp_market_id, trader_address and crossed. |
perp_market_id | STRING | Market the trade executed in, keyed like dimensions.perp_markets. |
interface_app_id | STRING | The app whose front end the trade came through, read from the registry table. |
exchange_app_id | STRING | The venue that matched the trade. |
token_id | STRING | The market’s settlement token. |
chain_id | STRING | Chain the trade executed on. |
project_id | STRING | Project the exchange app belongs to. |
trader_address | STRING | Address of the trader on this side. |
side | STRING | Which side this leg is: B for the buyer, A for the seller. |
crossed | BOOL | True on the taker’s leg, the trader who accepted an order that was already there; false on the maker’s. |
price | BIGNUMERIC | Price the trade filled at, in the settlement token. |
fee | BIGNUMERIC | Fee charged on this leg, in fee_token, before anything is shared out. |
fee_token | STRING | Token the fee was charged in. |
builder_fee | BIGNUMERIC | The front end’s share inside that fee. |
deployer_fee | BIGNUMERIC | The share going to whoever listed the market, inside that fee. |
trade_amount | BIGNUMERIC | How much was traded, in whatever the market tracks. |
Sample queries
- One market, one day
- Order-book volume
Read one perpetual market’s trades on a single day.
trade_amount is how much was traded, measured in whatever the market tracks, and price is the price it filled at. Multiply them for the trade’s notional value: the value of the contracts traded, which is not the same as cash changing hands.