For the complete documentation index, see llms.txt. This page is also available as Markdown.

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
    }
}
Parameter
Type
Description

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.

This is wire-compatible with Hyperliquid: HL clients sending the single coin: "BTC" field work as-is. The coins array is a Hyna extension for subscribing to several coins in one subscription.

Coins are additive — grow or shrink the set without gaps. A connection holds a single trades subscription, and re-subscribing adds the new coins to it (union), like subscribing to additional bbo coins — no error, no unsubscribe/resubscribe cycle, and no gap in delivery for coins you already hold. To drop coins, send an unsubscribe naming just those coins: they are removed from the set and the rest keep streaming uninterrupted. Re-sending an identical subscription is a no-op. Switching between a per-coin filter and the all-coins firehose still requires unsubscribing first (the two forms cannot coexist on one connection, since all trades frames share one channel with no per-subscription identity). Separate connections each get their own trades subscription. The coin cap (20/100/200) is counted cumulatively across the API key.

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:

Field
Description

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