The hip4_hyperliquid.market_trades table is the Hyperliquid HIP-4 fill ledger. Grain: one row per fill leg, keyed on (block_month, trade_id, trader, outcome_id). It has both sides of every match, plus the engine legs that mint, burn and settle outcome tokens. fill_type tells trades apart from the other legs. Every leg is present, so start_position gives each account’s balance before every change, and positions and open interest can be rebuilt exactly.
A match is either:
- Two legs on the same token: a buyer and a seller, sharing a
trade_id.
- One leg on each side of the market: a Yes buyer matched with a No buyer, or a Yes seller with a No seller, at prices that sum to 1. These legs have their own
trade_ids and sit at consecutive event_index values in the same block.
SUM(amount_usd) over all rows counts every match twice. For traded volume, filter is_taker AND fill_type = 'trade'.
Table Schema
Table sample
block_month is the partition key. Always include a block_month filter alongside any block_time range.
Example query
For volume and trade counts only, open_interest_hourly is much cheaper and returns the same totals. Use market_trades when you need what only the ledger has: individual accounts, fees, and non-trade legs. Fees are charged on merge and settlement legs as well as trades, so fee totals should include every fill type.