MMTMMT Docs
WebSocket

WebSocket API Overview

Real-time streaming market data via WebSocket, including available channels, usage patterns, and quick start examples.

The WebSocket API provides real-time streaming market data from cryptocurrency exchanges. Connect once and receive continuous updates as market events occur, enabling low-latency applications like live dashboards, trading bots, and real-time analytics.

When to Use WebSocket vs REST

Use CaseRecommended API
Historical data queriesREST
One-time data fetchesREST
Backfilling missing dataREST
Real-time price updatesWebSocket
Live trading dashboardsWebSocket
Automated trading botsWebSocket
Streaming candle updatesWebSocket

REST API is ideal for request-response patterns where you need specific data at a point in time.

WebSocket API is ideal for continuous data streams where latency matters and you need updates as they happen.

Available Channels

ChannelDescriptionRequires TimeframeRequires Bucket
candlesReal-time OHLCVT candle updatesYesNo
tradesIndividual trades as they occurNoNo
depthOrderbook depth updates (alias: orderbook)NoNo
statsMarket statistics updatesYesNo
oiOpen interest updatesYesNo
vdVolume delta updatesYesYes
volumesVolume profile updatesYesNo
heatmap_sdStandard density heatmap updatesYesNo
heatmap_hdHigh density heatmap updatesYesNo
flat_heatmap_sdStandard density flat heatmap updatesYesNo
flat_heatmap_hdHigh density flat heatmap updatesYesNo
stop_heatmapStop heatmap updates (flat format, hyperliquid/hyperliquid-xyz only)YesNo
tp_heatmapTake-profit heatmap updates (flat format, hyperliquid/hyperliquid-xyz only)YesNo
liquidation_heatmapLiquidation heatmap updates (flat format, hyperliquid/hyperliquid-xyz only)YesNo
liquidationsLiquidation eventsNoNo
marketsMarket overview data (price, 24h change, volume, market cap)NoNo

Channel Details

  • candles - Streaming candlestick data with open, high, low, close, volume, and trade count. Updates on each trade within the timeframe.

  • trades - Every individual trade execution. Highest frequency stream, useful for tick-by-tick analysis.

  • depth - Orderbook state updates. Provides bid/ask levels for market depth visualization. You can also subscribe using "orderbook" as an alias for "depth".

  • stats - Per-timeframe market statistics including mark/funding, liquidations, orderbook depth skews, and TPS metrics.

  • oi - Open interest changes for futures/perpetual markets.

  • vd - Volume delta (buying vs selling pressure) bucketed by trade size ranges.

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

  • heatmap_sd - Standard density orderbook heatmap for market depth visualization.

  • heatmap_hd - High density orderbook heatmap with finer price granularity.

  • flat_heatmap_sd - Standard density flat heatmap, same data as heatmap_sd in a flattened format optimized for rendering.

  • flat_heatmap_hd - High density flat heatmap, same data as heatmap_hd in a flattened format optimized for rendering.

  • stop_heatmap - Stop heatmap stream in flat format. Single-exchange only (no aggregation). Available only on hyperliquid and hyperliquid-xyz.

  • tp_heatmap - Take-profit heatmap stream in flat format. Single-exchange only (no aggregation). Available only on hyperliquid and hyperliquid-xyz.

  • liquidation_heatmap - Liquidation heatmap stream in flat format. Single-exchange only (no aggregation). Available only on hyperliquid and hyperliquid-xyz.

  • liquidations - Real-time liquidation events from the exchange.

  • markets - Market overview data including current price, 24h price change, buy/sell volumes, and market cap information.

Key Differences from REST

AspectREST APIWebSocket API
Data deliveryPull (you request)Push (server sends)
Rate limitingPer-request limitsConnection limits only
LatencyHigher (HTTP overhead)Lower (persistent connection)
ConnectionStatelessStateful (must manage lifecycle)
Best forHistorical queriesReal-time streams

No Polling Required

With WebSocket, you subscribe once and receive updates automatically. No need to repeatedly poll endpoints, reducing bandwidth and ensuring you never miss data between requests.

Connection Management

Unlike REST, WebSocket connections are persistent. Your application must:

  • Handle connection drops and reconnect
  • Resubscribe to channels after reconnection
  • Process incoming messages asynchronously

Aggregated Exchanges

Use colon-separated exchange IDs to subscribe to aggregated streams on supported channels. The exchange IDs must be unique and alphabetically ordered (for example, binancef:bybitf). Invalid aggregate exchange strings are rejected with INVALID_EXCHANGE:

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

For aggregated stats streams, mp (mark price) and fr (funding rate) are emitted as 0.

stop_heatmap, tp_heatmap, and liquidation_heatmap do not support aggregated exchanges and must use a single exchange ID. They are available only for hyperliquid and hyperliquid-xyz.

Quick Example

Connect

wss://eu-central-1.mmt.gg/api/v1/ws?api_key=YOUR_KEY

By format:

  • format=json (default): messages are WebSocket text frames
  • format=cbor: messages are WebSocket binary frames

Available regions:

  • eu-central-1.mmt.gg

Subscribe to a Channel

Once connected, send a JSON message to subscribe:

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

Receive Updates

The server will stream updates as they occur:

{
  "type": "data",
  "channel": "candles",
  "exchange": "binancef",
  "symbol": "btc/usd",
  "tf": "1m",
  "id": "candles.binancef.btc/usd.60",
  "data": {
    "t": 1704067200,
    "o": 42150.5,
    "h": 42175.0,
    "l": 42140.0,
    "c": 42165.5,
    "vb": 1500000.00,
    "vs": 1400000.00,
    "tb": 1250,
    "ts": 1180
  }
}

Unsubscribe

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

Next Steps

On this page