Latest Trade Price (Real-time Tick Data) Batch Subscription
English / 中文
Interface Description
This API supports batch subscription to real-time trade prices (tick-by-tick data) but does not provide historical trade prices.
Each WebSocket connection allows one active subscription at a time. Sending a new subscription request overwrites the previous one. Example: If you initially subscribe to A, B, C and want to add E, F, G, you must resend A, B, C, E, F, G in a single request. Once subscribed, real-time data will be pushed automatically.
Important Notes: 1、Do not repeatedly send subscription requests. After a successful subscription, send a heartbeat every 10 seconds. If no heartbeat is received for 30 seconds, the server will assume a timeout and disconnect the WebSocket. 2、Implement automatic reconnection. To handle network disconnections, clients should implement an auto-reconnect mechanism.
Interface Limitations
Please be sure to read: [ Websocket Interface Limitations ].
Please be sure to read: [ Error Code Descriptions ].
API Endpoints
1、Stock Market Data API for US, HK, A-shares, and Index:
Base Path: /quote-stock-b-ws-api
Full URL: wss://quote.alltick.io/quote-stock-b-ws-api
2、API for Forex, Precious Metals, Cryptocurrencies, and Commodities:
Base Path: /quote-b-ws-api
Full URL: wss://quote.alltick.io/quote-b-ws-api
Request Examples
1、Request Example for US, HK, A-shares, and Index Data:
Each time you establish a connection, you must append your authentication token to the URL as follows:
wss://quote.alltick.io/quote-stock-b-ws-api?token=your_token
After a successful connection, you can subscribe to specific stock market data as needed. Please refer to the documentation below for detailed calling methods.
2、Request Example for Forex, Precious Metals, Cryptocurrencies, and Commodities:
Each time you establish a connection, you must append your authentication token to the URL as follows:
wss://quote.alltick.io/quote-b-ws-api?token=your_token
After a successful connection, you can subscribe to specific forex, cryptocurrency, precious metals, and commodities data as needed. Please refer to the documentation below for detailed calling methods.
Request - Protocol Number:22004
Json definition
cmd_id
protocol number
integer
Yes
The protocol number for the latest trade price data request is fixed: 22004
seq_id
response id
integer
Yes
Subscription request identifier, which will be returned in the response. (Customizable and can be repeated for each request)
trace
traceable id
string
Yes
Traceable ID for request log information (Customizable, and it should not be repeated for each request)
symbol_list
Symbol List
array
Yes
See the symbol definition below for the specific format.
symbol definition
code
Code
string
Yes
Data Structure (JSON))
Response-protocol number:22005
Data Structure (JSON)
Push - Protocol Number: 22998
Definition of data
code
Code
string
seq
Quote Number
string
tick_time
Quote Timestamp
string
In milliseconds
price
Transaction Price
string
volumn
Transaction Volume
string
turnover
Transaction Turnover
string
Turnover:
For forex, precious metals, and energy, turnover is not provided. You can calculate it using the formula:
turnover = price * volume
.For stocks and cryptocurrencies, turnover is returned normally.
trade_direction
Transaction Direction
string
Trade Direction:
0 is the default value, 1 is Buy, and 2 is Sell.
For forex, precious metals, and energy, the default return is only 0.
For stocks and cryptocurrencies, it can return 0, 1, or 2 based on market conditions.
Detailed Explanation:
0: Neutral, indicating a trade executed at a price between the best bid and best ask.
1: Aggressive Buy, indicating a trade executed at the ask price or higher.
2: Aggressive Sell, indicating a trade executed at the bid price or lower.
Data Structure (JSON)
Official Website
Official website: https://alltick.co/
Last updated
Was this helpful?