API Integration
Receive real-time quotes in your own code
Most users don't need this page — trading, strategies and notifications all work right on the website. It's for people who want to write their own code to receive real-time crypto prices over WebSocket.
Connection
Open a WebSocket connection to the URL below, replacing wsToken with your own token.
wss://api.zzztech.com.tw/ws/v1/symbol/quote?wsToken=**********Subscribing
Once connected, send JSON in the following format to subscribe to or unsubscribe from a symbol.
{
"event": "subscribe",
"data": {
"symbol": "BTCUSDT",
"provider": "Binance",
"market": "Client"
}
}subscribe, unSubscribe, subscriptionListBTCUSDT, ETHUSDTBinanceClient, FutureClientAvailable events:
Data Format
After subscribing, every real-time trade is pushed in the following format.
{
"m": "Client",
"s": "BTCUSDT",
"t": 1683259711641,
"p": "64250.5",
"v": "0.012"
}Code Examples
Below are complete, ready-to-run examples: connect, subscribe to spot and futures prices, and print the data you receive. For Python, install the websocket-client package first.
const socket = new WebSocket('wss://api.zzztech.com.tw/ws/v1/symbol/quote?wsToken=**********');
socket.addEventListener('open', () => {
// 訂閱比特幣現貨 / 以太幣合約
socket.send(JSON.stringify({
event: 'subscribe',
data: { symbol: 'BTCUSDT', provider: 'Binance', market: 'Client' },
}));
socket.send(JSON.stringify({
event: 'subscribe',
data: { symbol: 'ETHUSDT', provider: 'Binance', market: 'FutureClient' },
}));
// 查詢目前訂閱清單
socket.send(JSON.stringify({ event: 'subscriptionList' }));
});
socket.addEventListener('message', (event) => {
console.log('Received:', JSON.parse(event.data));
});
// 不再需要時取消訂閱
// socket.send(JSON.stringify({ event: 'unSubscribe', data: { symbol: 'BTCUSDT', provider: 'Binance' } }));Important Notes
The number of symbols you can subscribe to at once depends on your plan.View Plan Details
