Messages
{
"jsonrpc": "2.0",
"id": 1,
"method": "subscribe",
"params": {
"channel": "fills",
"user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
}{
"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": 5110687635023935000,
"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
}
}
}Accounts Channels
fills
WSS
wss://api.hotstuff.trade/ws
/
Subscribe to real-time user fill updates. Account-specific channel.
WebSocket URL:
wss://api.hotstuff.trade/ws
Channel: fills
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
jsonrpc | string | Yes | JSON-RPC version | "2.0" |
id | string | Yes | Request identifier for tracking | "1" |
method | string | Yes | Action to perform | "subscribe" or "unsubscribe" |
channel | string | Yes | Channel name | "fills" |
user | string | Yes | User wallet address | "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" |
Supported Methods
subscribe- Subscribe to user fill updatesunsubscribe- 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": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
}
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": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
}
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: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
},
};
ws.send(JSON.stringify(subscribeMsg));
};
ws.onmessage = function (event) {
console.log("Received:", event.data);
};
Messages
{
"jsonrpc": "2.0",
"id": 1,
"method": "subscribe",
"params": {
"channel": "fills",
"user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
}{
"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": 5110687635023935000,
"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
}
}
}Subscription request
type:object
Send subscribe/unsubscribe request
Fills channel event
type:object
Server-pushed JSON-RPC event
⌘I