trades
HL-compatible real-time trade stream, with optional firehose add-on.
Every live data message includes both routing identifiers with the same value:
{"type": "trades", "channel": "trades"}Other payload fields are omitted above. Existing clients may continue routing on either field.
HL-compatible per-coin trade stream. Each message contains a batch of WsTrade objects synthesized from block fills — one per matched (buyer, seller) pair.
Per-coin trades is included in every tier (20/100/200 coins for starter/growth/scale; higher bespoke limits are available — contact us). Streaming all coins with no coins filter is an add-on and requires the ws:allTrades permission.
Subscribe
{
"type": "subscribe",
"subscription": {
"type": "trades",
"coin": "BTC", // optional, single-coin (HL-native shape)
"coins": ["xyz:SP500", "BTC"] // optional, multi-coin; omit both for the all-coins firehose
}
}coin
string
Single-coin filter (HL's native wire shape, accepted for compatibility). Full coin string including any prefix, e.g. "BTC", "xyz:SP500", "#90", "@107" / "PURR/USDC" (spot).
coins
string[]
Multi-coin filter (case-sensitive, up to the tier's coin cap: 20/100/200). Same coin format as coin.
coin and coins may be combined — their union is the effective coin set. Omitting both makes this the all-coins firehose, which requires the ws:allTrades add-on permission.
Unsubscribe
Name coins to remove just those from the active set (remaining coins keep streaming, gap-free):
Omit coins to clear the connection's trades subscription entirely:
Trade data format
The response matches HL's WsTrade shape exactly. Trades are batched per block, ordered by the underlying fill order — ascending (time, tx_index), so the earliest fill in the block appears first.
Field semantics:
coin
Coin identifier (matches coins filter format).
side
The taker's side. "B" = taker bought, "A" = taker sold.
px
Trade price.
sz
Trade size.
hash
Fill hash.
time
Trade timestamp (ms).
tid
Trade id. Unique within (coin, time); for a globally unique id use (block_time, coin, tid).
users
[buyer, seller] — matches Hyperliquid. The taker is users[0] when side="B" and users[1] when side="A" (use side to identify the taker).
Common errors
(Only the no-filter firehose form requires the add-on; per-coin trades is included in every tier.)
Examples
Last updated