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.

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 (5/25/100 coins for starter/growth/scale). 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 max_coins: 5/25/100). 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.

Unsubscribe

{
    "type": "unsubscribe",
    "subscription": {
        "type": "trades",
        "coins": ["BTC"]
    }
}

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