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.

Connecting requires a WsToken. After signing up, you can find it on the Overview tab of Account & Settings.Get Token

Connection

Open a WebSocket connection to the URL below, replacing wsToken with your own token.

URL
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.

Request
{ "event": "subscribe", "data": { "symbol": "BTCUSDT", "provider": "Binance", "market": "Client" } }
eventEvent namesubscribe, unSubscribe, subscriptionList
symbolSymbolBTCUSDT, ETHUSDT
providerData source: BinanceBinance
marketBinance only: Client (spot) or FutureClient (futures)Client, FutureClient

Available events:

subscribeSubscribe to market data
unSubscribeUnsubscribe
subscriptionListList current subscriptions (no data needed)

Data Format

After subscribing, every real-time trade is pushed in the following format.

Response
{ "m": "Client", "s": "BTCUSDT", "t": 1683259711641, "p": "64250.5", "v": "0.012" }
mMarket (optional)
sSymbol
tTimestamp (milliseconds)
pPrice
vVolume

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.

JavaScript
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

Still stuck?

Tell us which step you are on and we will help you out