Skip to content

Latest commit

 

History

History
142 lines (124 loc) · 6.46 KB

File metadata and controls

142 lines (124 loc) · 6.46 KB

English | 中文

Subscription real-time quote data interface instructions

Interface Description

This interface supports subscribing to the latest market depth (real-time tick-by-tick, Order Book) data for products, but does not support historical market depth or historical tick data.
Interface Features: For each WebSocket connection, sending this request will overwrite the previous subscription by default. For example, if you initially subscribed to products A, B, and C and want to add E, F, and G, you must resend A, B, C, E, F, and G. After successful subscription, data will be pushed.

Note:
1、After a successful subscription, avoid frequent requests. Send a heartbeat every 10 seconds; if no heartbeat is received in 30 seconds, the WebSocket will disconnect.
2、Implement automatic reconnection logic to handle network disconnections.
3、Maximum market depth limits for each product:
- 3.1 Inactive products may have less depth than listed.
- 3.2 One side of the depth may be empty, such as during limit up or down for stocks.

FX、Metals Cryptocurrency HK Stocks CN Stocks
Order Book Description Maximum 1 gears Maximum 5 gears Maximum 10 gears Maximum 5 gears

Interface Limitations

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.co/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.co/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.co/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.co/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: 22002

Data Format: JSON

Data Structure

Definition of data

Field Name Type Required Description
symbol_list Product List array Yes Specific format see below symbol definition

Symbol Definition

Field Name Type Required Description
code Code string Yes Refer to the code list and select the code you want to query:Click on the code list
Note: The case of the code value must be consistent with the code in the product list.
depth_level Depth Level uint32 No If there is no depth_level field, the backend will only provide one level of quotes. If the requested level is greater than the actual quote level, or if there is no depth_level field, the backend will provide as many levels as there are actual quotes

Request Example

{
    "cmd_id":22002,
    "seq_id":123,
    "trace":"asdfsdfa",
    "data":{
        "symbol_list": [
            {
		"code": "HK-1288",
                "depth_level": 5,
            },
	],
    }
}

Response - Protocol Number: 22003

Data Format: JSON

Data Structure

Definition of data

Field Name Type Description

Response Example

{
    "ret":200,
    "msg":"ok",
    "cmd_id":22003,
    "seq_id":123,
    "trace":"asdfsdfa",
    "data":{
    }    
}

Push - Protocol Number: 22999

Data Format: JSON

Data Structure

Definition of data

Field Name Type Description
code Code string Specific content, refer to the code list
seq Quote Number integer
tick_time Quote Timestamp integer In milliseconds
bids Bid Depth array See below for bids definition
asks Ask Depth array See below for asks definition

bids definition

Field Name Type Description
price Bid Price string
volume Bid Volume string 1、Forex, precious metals, and CFD indices do not provide volume.
2、Stocks and cryptocurrency data provide volume.

asks definition

Field Name Type Description
price Ask Price string
volume Ask Volume string 1、Forex, precious metals, and CFD indices do not provide volume.
2、Stocks and cryptocurrency data provide volume.

Response Example

{
    "cmd_id":22999,
    "data":{
	"code": "HK-1288",
        "seq": 1605509068000001,
        "tick_time": 1605509068,
        "bids": [
            {
                "price": "9.12",
                "volume": "9.12",
            },
        ],
        "asks": [
            {
                "price": "147.12",
                "volume": "147.12",
            },
        ],
    }
}