Messages
{
"jsonrpc": "2.0",
"id": 1,
"method": "subscribe",
"params": {
"channel": "orders",
"user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
}{
"jsonrpc": "2.0",
"method": "event",
"params": {
"channel": "orders@0x42C183edba036906447372a7c81Eb89D0B9f2175",
"data": {
"instrument_id": 1,
"instrument": "BTC-PERP",
"account": "0x42C183edba036906447372a7c81Eb89D0B9f2175",
"tif": "GTC",
"order_id": 172561523,
"cloid": "69901641-e0ad-47eb-80bf-f285321f5bd0",
"side": "b",
"position_side": "BOTH",
"limit_price": "67977",
"size": "0.06107",
"old_price": "67977",
"old_size": "0.06107",
"unfilled": "0.05737",
"state": "open",
"reduce_only": false,
"post_only": false,
"timestamp": 1770854411081
}
}
}Accounts Channels
orders
WSS
wss://api.hotstuff.trade/ws
/
Subscribe to real-time user order status updates.
Example Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "subscribe",
"params": {
"channel": "orders",
"user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
}
Example Response
{
"jsonrpc": "2.0",
"method": "event",
"params": {
"channel": "orders@0x42C183edba036906447372a7c81Eb89D0B9f2175",
"data": {
"instrument_id": 1,
"instrument": "BTC-PERP",
"account": "0x42C183edba036906447372a7c81Eb89D0B9f2175",
"tif": "GTC",
"order_id": 172561523,
"cloid": "69901641-e0ad-47eb-80bf-f285321f5bd0",
"side": "b",
"position_side": "BOTH",
"limit_price": "67977",
"size": "0.06107",
"old_price": "67977",
"old_size": "0.06107",
"unfilled": "0.05737",
"state": "open",
"reduce_only": false,
"post_only": false,
"timestamp": 1770854411081
}
}
}
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": "orders",
"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: "orders",
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": "orders",
"user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
}{
"jsonrpc": "2.0",
"method": "event",
"params": {
"channel": "orders@0x42C183edba036906447372a7c81Eb89D0B9f2175",
"data": {
"instrument_id": 1,
"instrument": "BTC-PERP",
"account": "0x42C183edba036906447372a7c81Eb89D0B9f2175",
"tif": "GTC",
"order_id": 172561523,
"cloid": "69901641-e0ad-47eb-80bf-f285321f5bd0",
"side": "b",
"position_side": "BOTH",
"limit_price": "67977",
"size": "0.06107",
"old_price": "67977",
"old_size": "0.06107",
"unfilled": "0.05737",
"state": "open",
"reduce_only": false,
"post_only": false,
"timestamp": 1770854411081
}
}
}Subscription request
type:object
Send subscribe/unsubscribe request
Channel event
type:object
Server-pushed JSON-RPC event
⌘I