Skip to main content
Subscribe to real-time user fill updates. Account-specific channel. WebSocket URL: wss://api.hotstuff.trade/ws Channel: fills

Parameters

ParameterTypeRequiredDescriptionExample
jsonrpcstringYesJSON-RPC version"2.0"
idstringYesRequest identifier for tracking"1"
methodstringYesAction to perform"subscribe" or "unsubscribe"
channelstringYesChannel name"fills"
userstringYesUser wallet address"0xxxx"

Supported Methods

  • subscribe - Subscribe to user fill updates
  • unsubscribe - Unsubscribe from user fill updates

Authentication

This endpoint requires a valid user wallet address to receive account-specific fill updates.

Example Request

{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "subscribe",
  "params": {
    "channel": "fills",
    "user": "0xxxx"
  }
}

Example Response

{
    "jsonrpc": "2.0",
    "method": "event",
    "params": {
        "channel": "fills@0x42C183edba036906447372a7c81Eb89D0B9f2175",
        "data": {
            "instrument_id": 1,
            "instrument": "BTC-PERP",
            "account": "0x42C183edba036906447372a7c81Eb89D0B9f2175",
            "order_id": 172559639,
            "cloid": "58172def-5a81-408f-88a0-329b6e482b15",
            "trade_id": 5110687635023935944,
            "side": "b",
            "position_side": "BOTH",
            "price": 67977,
            "size": 0.05113,
            "closed_pnl": 0.069513,
            "direction": "openLong",
            "original_size": 0.00545,
            "original_price": 67977,
            "fee": -0.069513,
            "broker_fee": 0,
            "fee_token_id": 1,
            "crossed": false,
            "tx_hash": "0x55cbd08b1249771a68e83e0a70330ab95c1fc7b46034068de9ad7f38ce12200a",
            "block_timestamp": 1770854228441,
            "fill_type": 2
        }
    }
}

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": "fills",
            "user": "0xxxx"
        }
    }
    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": "fills",
            "user": "0xxxx"
        }
    };
    ws.send(JSON.stringify(subscribeMsg));
};

ws.onmessage = function(event) {
    console.log('Received:', event.data);
};