Messages
{
"jsonrpc": "2.0",
"id": 1,
"method": "subscribe",
"params": {
"channel": "chart",
"instrument_id": 1,
"chart_type": "mark",
"resolution": "1"
}
}{
"jsonrpc": "2.0",
"method": "event",
"params": {
"channel": "chart:1:index:1",
"data": {
"time": 1770860580000,
"open": "67965.20189",
"high": "67965.20189",
"low": "67951.616513",
"close": "67951.616513",
"volume": "0.0029"
}
}
}Global Channels
chart
WSS
wss://api.hotstuff.trade/ws
/
Subscribe to real-time OHLCV chart data with configurable resolution and chart type for technical analysis.
Chart Types
mark- Mark price dataindex- Index price dataltp- LTP price data
Resolutions
1,5,15,30- Minute intervals (1, 5, 15, 30 minutes)60,240- Hour intervals (1 hour, 4 hours)1D,1W- Day/week intervals
Example Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "subscribe",
"params": {
"channel": "chart",
"symbol": "1",
"chart_type": "mark",
"resolution": "1"
}
}
Example Response
{
"jsonrpc": "2.0",
"method": "event",
"params": {
"channel": "chart:1:index:1",
"data": {
"time": 1770860580000,
"open": "67965.20189",
"high": "67965.20189",
"low": "67951.616513",
"close": "67951.616513",
"volume": "0.0029"
}
}
}
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": "chart",
"symbol": "1",
"chart_type": "mark",
"resolution": "1"
}
}
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: "chart",
symbol: "1",
chart_type: "mark",
resolution: "1",
},
};
ws.send(JSON.stringify(subscribeMsg));
};
ws.onmessage = function (event) {
console.log("Received:", event.data);
};
Messages
{
"jsonrpc": "2.0",
"id": 1,
"method": "subscribe",
"params": {
"channel": "chart",
"instrument_id": 1,
"chart_type": "mark",
"resolution": "1"
}
}{
"jsonrpc": "2.0",
"method": "event",
"params": {
"channel": "chart:1:index:1",
"data": {
"time": 1770860580000,
"open": "67965.20189",
"high": "67965.20189",
"low": "67951.616513",
"close": "67951.616513",
"volume": "0.0029"
}
}
}Subscription request
type:object
Send subscribe/unsubscribe request
Chart channel event
type:object
Server-pushed JSON-RPC event
⌘I