AllTick API Docs
API Status
  • Welcome
  • Integration Process
    • Process Description
    • Market Address Description
      • HTTP Quotes API Address Description
      • Websocket Quotes API Address Description
    • Token application
    • Interface restriction description
      • HTTP interface restrictions
      • Websocket interface limitations
      • Error code description
    • Universal standard header description
      • HTTP Common Standard Headers
      • Websocket Common Standard Header
    • Product Code List
      • A Share
      • Hong Kong Stock
      • US Stock
      • Cryptocurrency (Digital Currency)
      • Commodity (Precious Metals)
      • Forex
  • REST API
    • HTTP request example
    • HTTP interface API
      • GET Single Product K line query(High Low, Open, Close)
      • POST Query the latest 2 K lines of products in batches(High , Low, Open, Close)
      • GET Order Book(Depth) Query
      • GET Latest transaction price query(Latest Price)
      • GET Stocks product information query
      • Price changes, Market closure, Holidays, Limit up/down, New listings, and Delistings
  • Websocket API
    • Websocket request example
    • Websocket Interface API
      • Latest Trade Price (Real-time Tick Data) Batch Subscription
      • Order Book (Real-time Tick-by-Tick, Market Depth) Subscription
      • Cancel quote subscription
      • Ping Pong
      • K-line push (not supported)
  • FAQs
    • Basic usage
      • What types of financial data does AllTick provide?
      • How to obtain an API key from AllTick?
      • What is the data update frequency of AllTick?
      • How to integrate AllTick data into my application?
      • What programming languages does AllTick support for API calls?
      • Can I use AllTick's data for commercial purposes?
      • How to contact AllTick customer support?
      • Does AllTick's API have request limitations?
      • How to report data issues or API malfunctions?
      • Does AllTick provide real-time or delayed data?
    • Subscription and Account Management
      • How to register an AllTick account?
      • Does AllTick offer a free trial period?
      • How to cancel AllTick's subscription service?
      • What services does my subscription include?
      • How to upgrade my AllTick subscription plan?
      • How to change my account information?
      • I forgot my login password, what should I do?
      • How to secure my AllTick account?
      • Can multiple people share one AllTick account?
      • Can my subscription be refunded?
    • Data usage and technical issues
      • How to Use AllTick's WebSocket Service?
      • What data formats does AllTick's API support?
      • How to Handle High-Frequency Updates of AllTick Data?
      • I encountered a technical problem when using the API, how can I solve it?
      • How to ensure the accuracy of data received from AllTick?
      • Does AllTick Provide Historical Data Query?
      • How do I limit my data usage to avoid exceeding my subscription limits?
      • Does AllTick's API support batch requests?
      • How can I get real-time notifications and alerts on specific financial markets?
      • Does AllTick provide data analysis and visualization tools?
Powered by GitBook
On this page
  • Interface Description
  • Interface Limitations
  • API Endpoints
  • Request Examples
  • Request - Protocol Number:22002
  • Data Structure (JSON)
  • Response-protocol number:22003
  • Data Structure (JSON)
  • Push - Protocol Number: 22999
  • Data Structure (JSON)
  • Official Website

Was this helpful?

  1. Websocket API
  2. Websocket Interface API

Order Book (Real-time Tick-by-Tick, Market Depth) Subscription

PreviousLatest Trade Price (Real-time Tick Data) Batch SubscriptionNextCancel quote subscription

Last updated 1 month ago

Was this helpful?

English /

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、Energy
Cryptocurrency
HK Stocks
Chinese Stocks

Order Book Description

Maximum 1 gears(Only Price, No Volume)

Maximum 5 gears

Maximum 10 gears

Maximum 5 gears

Interface Limitations

  1. Please be sure to read:

  2. Please be sure to read:

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:22002

Json definition

Field
Name
Type
Required
Description

cmd_id

protocol number

integer

Yes

The protocol number for the order book data request is fixed: 22002

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

Product List

array

Yes

See the symbol definition below for the specific format.

Symbol definition

Field
Name
Type
Required
Description

code

Code

string

Yes

depth_level

Depth level

uint32

No

If there is no depth_level field, the background will only provide a quote for one layer, and the requested level is greater than the actual quote level, or if there is no depth_level field, the background will provide as many layers as there are actual quotes.

Data Structure (JSON)

{
    "cmd_id":22002,
    "seq_id":123,
    "trace":"3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
    "data":{
        "symbol_list": [
            {
                "code": "BTCUSDT",
                "depth_level": 5
            }
        ]
    }
}

Response-protocol number:22003

Data Structure (JSON)

{
    "ret":200,
    "msg":"ok",
    "cmd_id":22003,
    "seq_id":123,
    "trace":"3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
    "data":{
    }    
}

Push - Protocol Number: 22999

Definition of data

Field
Name
Type
Description

code

Code

string

seq

Quote Number

string

tick_time

Quote Timestamp

string

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.

Data Structure (JSON)

{
    "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"
            }
        ]
    }
}

Official Website

For specific content, please refer to the code list :

Specific content, refer to the code list:

Official website:

中文
[ Websocket Interface Limitations ].
[ Error Code Descriptions ].
https://alltick.co/
[Click on the code list]
[Click on the code list]