MMTMMT Docs
WebSocket

Channels

Complete reference for all WebSocket data channels, subscription parameters, and message formats.

This page documents all available WebSocket channels, their subscription parameters, and the data format for each message type.

For full type definitions, see the Types page.

Message Format

All data messages follow this structure:

{
  "type": "data",
  "channel": "<channel_name>",
  "exchange": "<exchange_id>",
  "symbol": "<symbol>",
  "tf": "<timeframe>",
  "id": "<subject>",
  "data": { ... }
}
FieldTypeDescription
typestringAlways "data" for data messages
channelstringChannel name (e.g., "candles", "trades")
exchangestringExchange ID (e.g., "binancef"). Aggregated streams use colon-separated, unique, alphabetically ordered IDs (e.g., "binancef:bybitf"). Invalid aggregate strings return INVALID_EXCHANGE.
symbolstringTrading pair (e.g., "btc/usd")
tfstringTimeframe string, included for channels that use timeframes
idstringSubject identifier (e.g., "candles.binancef.btc/usd.60")
dataobjectChannel-specific data payload

The tf field is included for channels that use timeframes (candles, stats, oi, vd, volumes, heatmap_sd, heatmap_hd, flat_heatmap_sd, flat_heatmap_hd, stop_heatmap, tp_heatmap, liquidation_heatmap). It contains a human-readable timeframe string like "1m", "5m", "1h", "1d".

stop_heatmap, tp_heatmap, and liquidation_heatmap must use a single exchange ID (no aggregated exchanges), and are available only for hyperliquid and hyperliquid-xyz.

The id field contains the subject publish string that uniquely identifies this data stream. For example, "candles.binancef.btc/usd.60" for 1-minute candles on Binance Futures BTC/USD.

candles

Real-time OHLCVT candlestick updates. A message is sent on every trade that updates the current candle.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"candles"
exchangestringYesExchange ID (e.g., "binancef")
symbolstringYesTrading pair (e.g., "btc/usd")
tfstringYesTimeframe (e.g., "1m" for 1 minute)
{
  "type": "subscribe",
  "channel": "candles",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m"
}

Data Message

FieldTypeDescription
typestring"data"
channelstring"candles"
exchangestringExchange ID
symbolstringTrading pair
tfstringTimeframe (e.g., "1m", "5m", "1h")
dataOHLCVTCandle data
{
  "type": "data",
  "channel": "candles",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m",
  "id": "candles.binancef.btc/usd.60",
  "data": {
    "t": 1704067200,
    "o": 42000.50,
    "h": 42150.00,
    "l": 41950.00,
    "c": 42100.00,
    "vb": 1500000.00,
    "vs": 1400000.00,
    "tb": 1250,
    "ts": 1180
  }
}

OHLCVT Fields

FieldTypeDescription
tint64Candle timestamp (Unix seconds)
ofloat64Open price
hfloat64High price
lfloat64Low price
cfloat64Close price
vbfloat64Buy volume (USD)
vsfloat64Sell volume (USD)
tbint64Buy trade count
tsint64Sell trade count

trades

Real-time individual trade executions. Every trade that occurs on the exchange is streamed immediately.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"trades"
exchangestringYesExchange ID
symbolstringYesTrading pair
{
  "type": "subscribe",
  "channel": "trades",
  "exchange": "binancef",
  "symbol": "btc/usd"
}

Data Message

FieldTypeDescription
typestring"data"
channelstring"trades"
exchangestringExchange ID
symbolstringTrading pair
dataTradeTrade data
{
  "type": "data",
  "channel": "trades",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "id": "trades.binancef.btc/usd",
  "data": {
    "id": "3065401760",
    "t": 1704067200123,
    "p": 42050.00,
    "q": 0.5,
    "b": true
  }
}

Trade Fields

FieldTypeDescription
idstringTrade ID from exchange
tint64Trade timestamp (Unix milliseconds)
pfloat64Trade price
qfloat64Trade quantity (base currency)
bboolTrade side (true = buy, false = sell)

depth

Orderbook depth updates showing bid and ask levels. Works like Binance's depth stream - you receive incremental updates containing only the levels that changed.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"depth"
exchangestringYesExchange ID
symbolstringYesTrading pair
{
  "type": "subscribe",
  "channel": "depth",
  "exchange": "binancef",
  "symbol": "btc/usd"
}

Data Message

FieldTypeDescription
typestring"data"
channelstring"depth"
exchangestringExchange ID
symbolstringTrading pair
dataOrderbookOrderbook update data
{
  "type": "data",
  "channel": "depth",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "id": "depth.binancef.btc/usd",
  "data": {
    "t": 1704067200123,
    "a": [[42001, 1.2], [42002, 0]],
    "b": [[42000, 1.5], [41999, 2.0]],
    "lp": 42050.00,
    "snapshot": false,
    "seq": 123456
  }
}

Orderbook Fields

FieldTypeDescription
tint64Timestamp (Unix milliseconds)
afloat64[][]Ask updates as [price, quantity] pairs
bfloat64[][]Bid updates as [price, quantity] pairs
lpfloat64Last traded price
snapshotboolWhether this message is a full snapshot
seqint64Orderbook sequence number

Handling Orderbook Updates

Messages contain only the levels that changed since the last update. Maintain local orderbook state and apply updates:

  • quantity > 0: Set or update the level at that price
  • quantity = 0: Remove the level at that price
// Local orderbook state
const orderbook = {
  asks: new Map(), // price -> quantity
  bids: new Map(), // price -> quantity
  lastPrice: 0
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);

  if (msg.channel === 'depth') {
    // Apply ask updates
    for (const [price, qty] of msg.data.a) {
      if (qty === 0) {
        orderbook.asks.delete(price);
      } else {
        orderbook.asks.set(price, qty);
      }
    }

    // Apply bid updates
    for (const [price, qty] of msg.data.b) {
      if (qty === 0) {
        orderbook.bids.delete(price);
      } else {
        orderbook.bids.set(price, qty);
      }
    }

    orderbook.lastPrice = msg.data.lp;
  }
};

Snapshots

Full orderbook snapshots are sent every ~60 seconds as a consistency checkpoint. Snapshots contain all levels currently in the book. You can identify a snapshot by the larger number of levels compared to regular updates.

After reconnection: Clear your local orderbook state and rebuild from incoming messages. The first message after subscribing will help establish state, and periodic snapshots ensure consistency.


stats

Market statistics including funding rates, liquidations, orderbook depth metrics, and TPS (trades per second).

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"stats"
exchangestringYesExchange ID. For aggregated stats, use colon-separated, unique, alphabetically ordered IDs (e.g., "binancef:bybitf"). Invalid aggregate strings return INVALID_EXCHANGE.
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
{
  "type": "subscribe",
  "channel": "stats",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m"
}

Aggregated stats subscription example:

{
  "type": "subscribe",
  "channel": "stats",
  "exchange": "binancef:bybitf",
  "symbol": "btc/usd",
  "tf": "1m"
}

Data Message

FieldTypeDescription
typestring"data"
channelstring"stats"
exchangestringExchange ID
symbolstringTrading pair
tfstringTimeframe (e.g., "1m", "5m", "1h")
dataStatStatistics data
{
  "type": "data",
  "channel": "stats",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m",
  "id": "stats.binancef.btc/usd.60",
  "data": {
    "t": 1704067200,
    "mp": 42050.00,
    "lp": 42100.00,
    "fr": 0.0001,
    "lb": 50000.00,
    "ls": 75000.00,
    "tlb": 15,
    "tls": 22,
    "vb": 1500000.00,
    "vs": 1400000.00,
    "tb": 1250,
    "ts": 1180,
    "sk": [0.15, 0.22, 0.18],
    "as": [500000, 1500000, 5000000],
    "bs": [600000, 1800000, 5500000],
    "mxt": 250,
    "mnt": 10,
    "avt": 85.5,
    "it": 95
  }
}

Stat Fields

FieldTypeDescription
tint64Timestamp (Unix seconds)
mpfloat64Mark price (0 when mark price is unavailable or on aggregated stats streams)
lpfloat64Last traded price
frfloat64Funding rate (0 on aggregated stats streams)
lbfloat64Liquidation buy volume (USD)
lsfloat64Liquidation sell volume (USD)
tlbint64Liquidation buy count
tlsint64Liquidation sell count
vbfloat64Buy volume (USD)
vsfloat64Sell volume (USD)
tbint64Buy trade count
tsint64Sell trade count
skfloat64[]Orderbook skews at depth levels
asfloat64[]Ask depth sums (USD) at levels
bsfloat64[]Bid depth sums (USD) at levels
mxtint64Maximum TPS in period
mntint64Minimum TPS in period
avtfloat64Average TPS in period
itint64Instantaneous TPS

For aggregated stats streams, mp and fr are 0 by design.


oi

Open interest OHLC candles for futures and perpetual markets. Tracks changes in open interest over time.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"oi"
exchangestringYesExchange ID
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
{
  "type": "subscribe",
  "channel": "oi",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m"
}

Data Message

FieldTypeDescription
typestring"data"
channelstring"oi"
exchangestringExchange ID
symbolstringTrading pair
tfstringTimeframe (e.g., "1m", "5m", "1h")
dataOHLCOpen interest OHLC data
{
  "type": "data",
  "channel": "oi",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m",
  "id": "oi.binancef.btc/usd.60",
  "data": {
    "t": 1704067200,
    "o": 5000000000,
    "h": 5100000000,
    "l": 4950000000,
    "c": 5050000000,
    "n": 60
  }
}

OHLC Fields

FieldTypeDescription
tint64Candle timestamp (Unix seconds)
ofloat64Open value (USD)
hfloat64High value (USD)
lfloat64Low value (USD)
cfloat64Close value (USD)
nint64Sample count

vd

Volume delta (buying vs selling pressure) OHLC candles, segmented by trade size buckets. Useful for analyzing institutional vs retail activity.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"vd"
exchangestringYesExchange ID
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
bucketintYesBucket group (1-11)
{
  "type": "subscribe",
  "channel": "vd",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m",
  "bucket": 1
}

Bucket Groups

BucketTrade Size Range (USD)
1All trades
2$1 - $1,000
3$1,000 - $10,000
4$10,000 - $25,000
5$25,000 - $50,000
6$50,000 - $100,000
7$100,000 - $250,000
8$250,000 - $500,000
9$500,000 - $1,000,000
10$1,000,000 - $5,000,000
11$5,000,000+

Data Message

FieldTypeDescription
typestring"data"
channelstring"vd"
exchangestringExchange ID
symbolstringTrading pair
tfstringTimeframe (e.g., "1m", "5m", "1h")
dataOHLCVolume delta OHLC data
{
  "type": "data",
  "channel": "vd",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m",
  "id": "vd.binancef.btc/usd.60",
  "data": {
    "t": 1704067200,
    "o": 50000,
    "h": 150000,
    "l": -75000,
    "c": 100000,
    "n": 847
  }
}

OHLC Fields

FieldTypeDescription
tint64Candle timestamp (Unix seconds)
ofloat64Open delta (USD) - positive = net buying
hfloat64High delta (USD)
lfloat64Low delta (USD)
cfloat64Close delta (USD)
nint64Trade count in bucket

Volume delta is calculated as buy_volume - sell_volume. Positive values indicate net buying pressure, negative values indicate net selling pressure.


volumes

Volume profile data showing buy/sell volumes at price levels.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"volumes"
exchangestringYesExchange ID
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
{
  "type": "subscribe",
  "channel": "volumes",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m"
}

Data Message

FieldTypeDescription
typestring"data"
channelstring"volumes"
exchangestringExchange ID
symbolstringTrading pair
tfstringTimeframe
dataVolumeVolume profile data
{
  "type": "data",
  "channel": "volumes",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m",
  "id": "volumes.binancef.btc/usd.60",
  "data": {
    "t": 1704067200,
    "p": [41900, 41950, 42000, 42050, 42100],
    "b": [50000, 75000, 120000, 80000, 45000],
    "s": [45000, 60000, 100000, 90000, 55000],
    "pg": 50
  }
}

Volume Fields

FieldTypeDescription
tint64Timestamp (Unix seconds)
pfloat64[]Price levels
bfloat64[]Buy volumes at each price (USD)
sfloat64[]Sell volumes at each price (USD)
pgfloat64Price grouping/bucket size

heatmap_sd

Standard density orderbook heatmap data.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"heatmap_sd"
exchangestringYesExchange ID
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
{
  "type": "subscribe",
  "channel": "heatmap_sd",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m"
}

Data Message

FieldTypeDescription
typestring"data"
channelstring"heatmap_sd"
exchangestringExchange ID
symbolstringTrading pair
tfstringTimeframe
dataHeatmapHeatmap data
{
  "type": "data",
  "channel": "heatmap_sd",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m",
  "id": "heatmap_sd.binancef.btc/usd.60",
  "data": {
    "t": 1704067200,
    "pg": 10,
    "p": [41500, 41510, 41520, 41530, 41540],
    "s": [100000, 250000, 500000, 300000, 150000],
    "si": 50,
    "lp": 42050.00,
    "minp": 41500.00,
    "maxp": 42500.00,
    "mins": 10000,
    "maxs": 1000000
  }
}

Heatmap Fields

FieldTypeDescription
tint64Timestamp (Unix seconds)
pgfloat64Price grouping/bucket size
pfloat64[]Price levels
sfloat64[]Sizes at each price level
siint64Split index (divides asks and bids in the arrays)
lpfloat64Last traded price
minpfloat64Minimum price in range
maxpfloat64Maximum price in range
minsfloat64Minimum size value
maxsfloat64Maximum size value

heatmap_hd

High density orderbook heatmap data with finer price granularity.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"heatmap_hd"
exchangestringYesExchange ID
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
{
  "type": "subscribe",
  "channel": "heatmap_hd",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m"
}

Data Message

Same format as heatmap_sd but with higher density price levels.


liquidations

Real-time liquidation events from the exchange.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"liquidations"
exchangestringYesExchange ID
symbolstringYesTrading pair
{
  "type": "subscribe",
  "channel": "liquidations",
  "exchange": "binancef",
  "symbol": "btc/usd"
}

Data Message

FieldTypeDescription
typestring"data"
channelstring"liquidations"
exchangestringExchange ID
symbolstringTrading pair
dataLiquidationLiquidation event data
{
  "type": "data",
  "channel": "liquidations",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "id": "liquidations.binancef.btc/usd",
  "data": {
    "t": 1704067200123,
    "p": 42050.00,
    "q": 1.5,
    "s": "sell"
  }
}

Liquidation Fields

FieldTypeDescription
tint64Timestamp (Unix milliseconds)
pfloat64Liquidation price
qfloat64Liquidation quantity
sstringSide: "buy" or "sell" (the side that was liquidated)

flat_heatmap_sd

Standard density flat heatmap data. Same data as heatmap_sd but in a flattened format optimized for rendering.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"flat_heatmap_sd"
exchangestringYesExchange ID
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
{
  "type": "subscribe",
  "channel": "flat_heatmap_sd",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m"
}

flat_heatmap_hd

High density flat heatmap data. Same data as heatmap_hd but in a flattened format optimized for rendering.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"flat_heatmap_hd"
exchangestringYesExchange ID
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
{
  "type": "subscribe",
  "channel": "flat_heatmap_hd",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m"
}

stop_heatmap

Stop heatmap stream in flat format.

Single-exchange only: aggregated exchange strings are not supported. Available exchange IDs: hyperliquid, hyperliquid-xyz.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"stop_heatmap"
exchangestringYesSingle exchange ID
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
{
  "type": "subscribe",
  "channel": "stop_heatmap",
  "exchange": "hyperliquid",
  "symbol": "btc/usd",
  "tf": "1m"
}

Data Message

FieldTypeDescription
typestring"data"
channelstring"stop_heatmap"
exchangestringExchange ID
symbolstringTrading pair
tfstringTimeframe
dataFlatHeatmapFlat heatmap data
{
  "type": "data",
  "channel": "stop_heatmap",
  "exchange": "hyperliquid",
  "symbol": "btc/usd",
  "tf": "1m",
  "id": "stop_heatmap.hyperliquid.btc/usd.60",
  "data": {
    "t": 1704067200,
    "pg": 10,
    "s": [100000, 250000, 500000, 300000, 150000],
    "si": 2,
    "lp": 42050.0,
    "minp": 42000.0,
    "maxp": 42040.0,
    "mins": 100000,
    "maxs": 500000
  }
}

tp_heatmap

Take-profit heatmap stream in flat format.

Single-exchange only: aggregated exchange strings are not supported. Available exchange IDs: hyperliquid, hyperliquid-xyz.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"tp_heatmap"
exchangestringYesSingle exchange ID
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
{
  "type": "subscribe",
  "channel": "tp_heatmap",
  "exchange": "hyperliquid",
  "symbol": "btc/usd",
  "tf": "1m"
}

Data Message

Same payload format as stop_heatmap (FlatHeatmap), with channel "tp_heatmap".


liquidation_heatmap

Liquidation heatmap stream in flat format.

Single-exchange only: aggregated exchange strings are not supported. Available exchange IDs: hyperliquid, hyperliquid-xyz.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"liquidation_heatmap"
exchangestringYesSingle exchange ID
symbolstringYesTrading pair
tfstringYesTimeframe (e.g., "1m")
{
  "type": "subscribe",
  "channel": "liquidation_heatmap",
  "exchange": "hyperliquid",
  "symbol": "btc/usd",
  "tf": "1m"
}

Data Message

Same payload format as stop_heatmap (FlatHeatmap), with channel "liquidation_heatmap".


markets

Real-time market data updates including current price, 24h price change, buy/sell volumes, and market cap information.

Subscribe

FieldTypeRequiredDescription
typestringYes"subscribe"
channelstringYes"markets"
exchangestringYesExchange ID
symbolstringYesTrading pair
{
  "type": "subscribe",
  "channel": "markets",
  "exchange": "binancef",
  "symbol": "btc/usd"
}

Data Message

FieldTypeDescription
typestring"data"
channelstring"markets"
exchangestringExchange ID
symbolstringTrading pair
dataMarketMarket data
{
  "type": "data",
  "channel": "markets",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "id": "markets.binancef.btc/usd",
  "data": {
    "t": 1704067200,
    "p": 42050.00,
    "p24": 41500.00,
    "pc": 550.00,
    "vb24": 15000000.00,
    "vs24": 14500000.00,
    "tb24": 125000.00,
    "ts24": 118000.00,
    "mc": 820000000000,
    "fdv": 880000000000,
    "cs": 19500000,
    "ts": 21000000,
    "ms": 21000000
  }
}

Market Fields

FieldTypeDescription
tint64Timestamp (Unix seconds)
pfloat64Current price
p24float64Price 24 hours ago
pcfloat64Price change (last 24h)
vb24float64Buy volume last 24h (USD)
vs24float64Sell volume last 24h (USD)
tb24float64Buy trade count last 24h
ts24float64Sell trade count last 24h
mcfloat64Market cap (USD)
fdvfloat64Fully diluted valuation (USD)
csfloat64Circulating supply
tsfloat64Total supply
msfloat64Max supply

Unsubscribing

To stop receiving updates for a channel, send an unsubscribe message with the same parameters:

{
  "type": "unsubscribe",
  "channel": "candles",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m"
}

For channels with additional parameters (like vd), include all parameters:

{
  "type": "unsubscribe",
  "channel": "vd",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m",
  "bucket": 1
}

On this page