Skip to content
iTick Relay

WebSocket streaming

The protocol matches the official iTick API: subscribe to symbols and the server pushes quotes, ticks and order book updates continuously.

Connecting

ItemDescription
Endpointwss://itick.dev/{market}, where market is one of stock, forex, crypto, indices, future, fund
AuthenticationThe token request header, or the ?token= query parameter (browsers cannot set headers)
ConnectionsConcurrent connections per API key per market are limited by your plan
SubscriptionsSymbols per connection are limited by your plan
HeartbeatSend a ping at least every 30 seconds
Symbol formatCODE$REGION, such as AAPL$US, 700$HK, BTCUSDT$BA

After connecting you first receive Connected Successfully and authenticated messages. The free plan does not include WebSocket by default, so the handshake returns 403.

Message format

Subscribe, heartbeat and pushes
// Subscribe / unsubscribe. types: tick, quote, depth, kline@1
{"ac":"subscribe","params":"AAPL$US,700$HK","types":"quote,tick"}
{"ac":"unsubscribe","params":"AAPL$US","types":"quote"}

// Heartbeat
{"ac":"ping","params":"1731688569840"}

// Pushed message
{"code":1,"data":{"s":"BTCUSDT","r":"BA","ld":83988.54,"v":0.00019,"type":"tick"}}

types can be tick, quote, depth or kline@1; whether kline@1 is available depends on your plan. Going over the subscription limit returns exceeding the maximum subscription limit.

JavaScript example

JavaScript
const ws = new WebSocket("wss://itick.dev/crypto?token=YOUR_API_KEY");

ws.onopen = () => {
  ws.send(JSON.stringify({ ac: "subscribe", params: "BTCUSDT$BA", types: "quote,tick" }));
  // Send a heartbeat at least every 30 seconds
  setInterval(() => ws.send(JSON.stringify({ ac: "ping", params: String(Date.now()) })), 25000);
};

ws.onmessage = (event) => console.log(event.data);

Good to know

  • When a token is disabled, reset or expires, its open connections are closed by the server. Reconnect and subscribe again after a disconnect.
  • The WebSocket handshake counts toward the per-minute request limit.
  • Several connections can subscribe to the same symbol without affecting each other.