Connection Addresses
| Data Type | WebSocket Address |
|---|---|
| US stocks, Hong Kong stocks, A shares, and major index data | wss://quote.alltick.co/quote-stock-b-ws-api?token=your_token |
| Forex, precious metals, cryptocurrencies, crude oil, CFD indices, and commodities | wss://quote.alltick.co/quote-b-ws-api?token=your_token |
Interface List
Latest Trade Price (Real-time Tick Data, Current Price, Latest Price) Batch Subscription
Subscribe to the latest trade price of products. After the subscription succeeds, trade data is pushed through protocol number 22998.
Latest Order Book (Real-time Tick-by-Tick Depth, Order Book) Subscription
Subscribe to the latest order book depth of products. After the subscription succeeds, order book data is pushed through protocol number 22999.
Heartbeat
Send a heartbeat every 10 seconds. If no heartbeat request is received within 30 seconds, the WebSocket connection will be disconnected.
Cancel Quote Subscription
Cancel all quote subscriptions, or cancel order book, trade, or exchange-rate subscriptions by type.
K-Line Push (Not Supported)
WebSocket does not support K-line push. K-lines can be polled or batch queried through HTTP interfaces.
WebSocket Request Example
View WebSocket request examples for Go, Java, PHP, and Python.
Protocol Number Overview
| Protocol Number | Description |
|---|---|
| 22004 / 22005 | Latest trade price subscription request / response |
| 22998 | Latest trade price push |
| 22002 / 22003 | Latest order book subscription request / response |
| 22999 | Latest order book push |
| 22000 / 22001 | Heartbeat request / response |
| 22006 / 22007 | Cancel quote subscription request / response |
Usage Flow
- Select the stock or non-stock WebSocket address according to the product type.
- Append the token to the connection URL and establish the WebSocket connection.
- Send a latest trade price or latest order book subscription request.
- Send a heartbeat request every 10 seconds to keep the connection valid.
- Receive data pushed by the server and handle automatic reconnection according to business needs.
- When pushes are no longer needed, send a cancel quote subscription request.
For each WebSocket connection, every time a subscription request is sent, the backend overwrites the previous subscription request by default. When adding products, you need to resend the complete product list.