Skip to main content
WSS
wss://api.hotstuff.trade/ws
/
Subscribe to real-time trade executions with price, size, and side information for trading instruments.

Example Request

{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "subscribe",
  "params": {
    "channel": "trades",
    "symbol": "BTC-PERP"
  }
}

Example Response

{
  "jsonrpc": "2.0",
  "method": "event",
  "params": {
    "channel": "trades:BTC-PERP",
    "data": {
      "instrument_id": 1,
      "instrument": "BTC-PERP",
      "trade_id": 1977789105883768779,
      "tx_hash": "0x7f3f0051f155a58a9362882ec3fe01162d0c2c3123d32fc87f89ac31ab039c4d",
      "side": "b",
      "price": "67804",
      "size": "0.00303",
      "maker": "0x14191D72B99Fb42E712360eF518e983e87d551Ec",
      "taker": "0xeE1c303b69Fe40B74BB7c2408e99C5415928EFcb",
      "timestamp": 1770859894258
    }
  }
}

WebSocket Client Examples

Python

import websocket
import json

def on_message(ws, message):
    print(f"Received: {message}")

def on_open(ws):
    subscribe_msg = {
        "jsonrpc": "2.0",
        "id": "1",
        "method": "subscribe",
        "params": {
            "channel": "trades",
            "symbol": "BTC-PERP"
        }
    }
    ws.send(json.dumps(subscribe_msg))

ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws",
                          on_message=on_message,
                          on_open=on_open)
ws.run_forever()

JavaScript

const ws = new WebSocket("wss://api.hotstuff.trade/ws");

ws.onopen = function () {
  const subscribeMsg = {
    jsonrpc: "2.0",
    id: "1",
    method: "subscribe",
    params: {
      channel: "trades",
      symbol: "BTC-PERP",
    },
  };
  ws.send(JSON.stringify(subscribeMsg));
};

ws.onmessage = function (event) {
  console.log("Received:", event.data);
};
Messages
Subscription request
type:object

Send subscribe/unsubscribe request

Channel event
type:object

Server-pushed JSON-RPC event