# POST Batch Query Latest 2 K-Lines for Products (High, Low, Open, Close)
Source: https://alltick.co/apis/en/api-reference/stock/batch-kline
This page explains AllTick stock HTTP batch K-line API for querying the latest two K-lines of multiple symbols in one request, covering US stocks, Hong Kong stocks, China A-shares and major indexes.
## POST /batch-kline
## **Interface Description**
This interface can batch query multiple products at once, and can also batch query multiple K-line types at once (K-line types refer to 1-minute, 15-minute, 30-minute, etc.). **However, it can only batch query the latest 2 K-lines.**
For customers using HTTP interfaces to obtain K-lines, we recommend using `/kline` together with `/batch-kline` as follows:
* First, use the `/kline` interface to poll historical data and store it in a local database. Later historical data can be obtained directly from the customer's database without making another interface request.
* Then, continuously use the `/batch-kline` interface to batch request the latest 2 K-lines for multiple products and update the database with the data.
This approach can quickly update the latest K-lines while avoiding frequency restrictions caused by frequent historical K-line requests.
## Request Frequency
| Plan | Individual Request | Requesting Multiple HTTP Interfaces at the Same Time |
| - | - | - |
| Free | 1. One request every 10 seconds.
2. Each request can batch query 10 groups of data. Each group = 1 product + 1 K-line type. For example, obtaining BTCUSDT 1-minute K-line and 5-minute K-line at the same time counts as 2 groups. | 1. Only one interface can be requested every 10 seconds.
**2. Note that the /batch-kline interface requires a 10-second interval.**
3. All interfaces combined: maximum 10 requests per minute (one every 6 seconds).
4. Maximum 1,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Basic | 1. One request every 3 seconds.
2. Each request can batch query 100 groups of data. Each group = 1 product + 1 K-line type. | 1. Only one interface can be requested in the same second.
2. All interfaces combined: maximum 60 requests per minute (one per second).
**3. Note that the /batch-kline interface requires a 3-second interval.**
4. Maximum 86,400 requests per day; usage resumes after midnight the next day if exceeded. |
| Premium | 1. One request every 2 seconds.
2. Each request can batch query 200 groups of data. Each group = 1 product + 1 K-line type. | 1. All interfaces combined: maximum 600 requests per minute (10 per second).
**2. Note that the /batch-kline interface requires a 2-second interval.**
3. Maximum 864,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Professional | 1. One request per second.
2. Each request can batch query 500 groups of data. Each group = 1 product + 1 K-line type. | 1. All interfaces combined: maximum 1,200 requests per minute (20 per second).
**2. Note that the /batch-kline interface requires a 1-second interval.**
3. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All Hong Kong Stocks | 1. One request per second.
2. Each request can batch query 500 groups of data. Each group = 1 product + 1 K-line type. | 1. All interfaces combined: maximum 1,200 requests per minute (20 per second).
**2. Note that the /batch-kline interface requires a 1-second interval.**
3. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All A Shares | 1. One request per second.
2. Each request can batch query 500 groups of data. Each group = 1 product + 1 K-line type. | 1. All interfaces combined: maximum 1,200 requests per minute (20 per second).
**2. Note that the /batch-kline interface requires a 1-second interval.**
3. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All US Stocks | 1. One request per second.
2. Each request can batch query 500 groups of data. Each group = 1 product + 1 K-line type. | 1. All interfaces combined: maximum 1,200 requests per minute (20 per second).
**2. Note that the /batch-kline interface requires a 1-second interval.**
3. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
## Interface Limitations
1. Be sure to read: [HTTP Interface Restrictions](/apis/en/getting-started/http-interface-restrictions)
2. Be sure to read: [Error Code Description](/apis/en/getting-started/error-code-description)
## API Endpoints
**1. US Stocks, Hong Kong Stocks, A Shares, and Major Index Data API Endpoint:**
* Base Path: `/quote-stock-b-api/batch-kline`
* Full URL: [https://quote.alltick.co/quote-stock-b-api/batch-kline](https://quote.alltick.co/quote-stock-b-api/batch-kline)
**2. Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities API Endpoint:**
* Base Path: `/quote-b-api/batch-kline`
* Full URL: [https://quote.alltick.co/quote-b-api/batch-kline](https://quote.alltick.co/quote-b-api/batch-kline)
## Request Examples
**1. Request example for US Stocks, Hong Kong Stocks, A Shares, and Major Index Data:**
For batch querying the latest K-lines of products, because there are many batch query parameters, they are placed in the body. Only the token parameter is kept in the URL parameters.
When sending a query request, you must include the method name and token information. Example:
[https://quote.alltick.co/quote-stock-b-api/batch-kline?token=your\_token](https://quote.alltick.co/quote-stock-b-api/batch-kline?token=your_token)
**2. Request example for Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities:**
For batch querying the latest K-lines of products, because there are many batch query parameters, they are placed in the body. Only the token parameter is kept in the URL parameters.
When sending a query request, you must include the method name and token information. Example:
[https://quote.alltick.co/quote-b-api/batch-kline?token=your\_token](https://quote.alltick.co/quote-b-api/batch-kline?token=your_token)
## **For batch querying the latest K-lines of products, because there are many batch query parameters, they are placed in the body. Only the token parameter is kept in the URL parameters.**
## Body Request Parameters
```json theme={null}
{
"trace": "c2a8a146-a647-4d6f-ac07-8c4805bf0b74",
"data": {
"data_list": [
{
"code": "700.HK",
"kline_type": 1,
"kline_timestamp_end": 0,
"query_kline_num": 1,
"adjust_type": 0
},
{
"code": "GOOGL.US",
"kline_type": 1,
"kline_timestamp_end": 0,
"query_kline_num": 1,
"adjust_type": 0
}
]
}
}
```
## Request Parameters
| Name | Position | Type | Required | Description |
| - | - | - | - | - |
| token | query | string | Yes | If you do not know your token, contact the relevant person to request it. |
| body | body | object | No | |
| » trace | body | string | Yes | Trace code used for log lookup. Ensure it is unique for each request. |
| » data | body | object | Yes | |
| »» data\_list | body | \[object] | Yes | |
| »»» code | body | string | Yes | View the code list and select the code you want to query: \[Click the code list]
**Note: The code value must match the case of the code in the product list.** |
| »»» kline\_type | body | integer | Yes | K-line type:
1. 1 is 1-minute K-line, 2 is 5-minute K-line, 3 is 15-minute K-line, 4 is 30-minute K-line, 5 is hourly K-line, 6 is 2-hour K-line (stocks do not support 2-hour K-line), 7 is 4-hour K-line (stocks do not support 4-hour K-line), 8 is daily K-line, 9 is weekly K-line, and 10 is monthly K-line. Note: stocks do not support 2-hour or 4-hour K-lines.
2. The shortest supported K-line is 1 minute.
3. To query **yesterday's closing price**, pass 8 for kline\_type. |
| »»» kline\_timestamp\_end | body | integer | Yes | Query K-lines backward from the specified time.
1. Pass 0 to query K-lines backward from the latest trading day.
2. Pass a timestamp to query K-lines backward from that timestamp.
3. Only forex, precious metals, and cryptocurrencies support timestamp input; stock codes do not. |
| »»» query\_kline\_num | body | integer | Yes | 1. Indicates how many K-lines to query. **This interface can query at most 2 K-lines.**
2. This field can be used to query **yesterday's closing price**: pass 8 for kline\_type and 2 for query\_kline\_num. Of the 2 returned K-line records, the one with the smaller timestamp is yesterday's closing price. |
| »»» adjust\_type | body | integer | Yes | Adjustment type. Effective only for stock codes. For example: 0: ex-rights, 1: forward-adjusted. Currently only 0 is supported. |
## Response Example
```json theme={null}
{
"ret": 200,
"msg": "ok",
"trace": "c2a8a146-a647-4d6f-ac07-8c4805bf0b74",
"data": {
"kline_list": [
{
"code": "700.HK",
"kline_type": 1,
"kline_data": [
{
"timestamp": "1677829200",
"open_price": "136.421",
"close_price": "136.412",
"high_price": "136.422",
"low_price": "136.407",
"volume": "0",
"turnover": "0"
}
]
},
{
"code": "GOOGL.US",
"kline_type": 1,
"kline_data": [
{
"timestamp": "1677829200",
"open_price": "136.421",
"close_price": "136.412",
"high_price": "136.422",
"low_price": "136.407",
"volume": "0",
"turnover": "0"
}
]
}
]
}
}
```
## Response Result
| Status Code | Status Meaning | Description | Data Model |
| - | - | - | - |
| 200 | OK | OK | Inline |
| Name | Type | Required | Description |
| - | - | - | - |
| » ret | integer | true | |
| » msg | string | true | |
| » trace | string | true | |
| » data | object | true | |
| »» kline\_list | \[array] | true | |
| »»» code | string | true | Product code |
| »»» kline\_type | integer | true | K-line type:
1. 1 is 1-minute K-line, 2 is 5-minute K-line, 3 is 15-minute K-line, 4 is 30-minute K-line, 5 is hourly K-line, 6 is 2-hour K-line (stocks do not support 2-hour K-line), 7 is 4-hour K-line (stocks do not support 4-hour K-line), 8 is daily K-line, 9 is weekly K-line, and 10 is monthly K-line. Note: stocks do not support 2-hour or 4-hour K-lines.
2. The shortest supported K-line is 1 minute. |
| »»» kline\_data | \[array] | true | |
| »»»» timestamp | string | true | Timestamp of the K-line |
| »»»» open\_price | string | true | Opening price of the K-line |
| »»»» close\_price | string | true | Closing price of the K-line:
1. During trading hours, for the latest K-line, this price is also the latest trade price.
2. During market closure, for the latest K-line, this price is the closing price. |
| »»»» high\_price | string | true | Highest price of the K-line |
| »»»» low\_price | string | true | Lowest price of the K-line |
| »»»» volume | string | true | Trading quantity of the K-line |
| »»»» turnover | string | true | Trading amount of the K-line |
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# POST /batch-kline Debug Module
Source: https://alltick.co/apis/en/api-reference/stock/debug/batch-kline
apis/api-reference/openapi.json POST /quote-stock-b-api/batch-kline
This page explains POST /batch-kline Debug Module for AllTick API, including integration context, parameters, response fields and usage notes for real-time market data workflows.
## POST /batch-kline Debug Module
# GET /depth-tick Debug Module
Source: https://alltick.co/apis/en/api-reference/stock/debug/depth-tick
apis/api-reference/openapi.json GET /quote-stock-b-api/depth-tick
This page explains GET /depth-tick Debug Module for AllTick API, including integration context, parameters, response fields and usage notes for real-time market data workflows.
## GET /depth-tick Debug Module
# GET /kline Debug Module
Source: https://alltick.co/apis/en/api-reference/stock/debug/kline
apis/api-reference/openapi.json GET /quote-stock-b-api/kline
This page explains GET /kline Debug Module for AllTick API, including integration context, parameters, response fields and usage notes for real-time market data workflows.
## GET /kline Debug Module
# GET /static_info Debug Module
Source: https://alltick.co/apis/en/api-reference/stock/debug/static-info
apis/api-reference/openapi.json GET /quote-stock-b-api/static_info
This page explains GET /static_info Debug Module for AllTick API, including integration context, parameters, response fields and usage notes for real-time market data workflows.
## GET /static\_info Debug Module
# GET /api/suspension/nasdaq Debug Module
Source: https://alltick.co/apis/en/api-reference/stock/debug/suspension-nasdaq
apis/api-reference/openapi.json GET /api/suspension/nasdaq
This page explains GET /api/suspension/nasdaq Debug Module for AllTick API, including integration context, parameters, response fields and usage notes for real-time market data workflows.
## GET /api/suspension/nasdaq Debug Module
# GET /api/suspension/nyse Debug Module
Source: https://alltick.co/apis/en/api-reference/stock/debug/suspension-nyse
apis/api-reference/openapi.json GET /api/suspension/nyse
This page explains GET /api/suspension/nyse Debug Module for AllTick API, including integration context, parameters, response fields and usage notes for real-time market data workflows.
## GET /api/suspension/nyse Debug Module
# GET /api/suspension/sse Debug Module
Source: https://alltick.co/apis/en/api-reference/stock/debug/suspension-sse
apis/api-reference/openapi.json GET /api/suspension/sse
This page explains GET /api/suspension/sse Debug Module for AllTick API, including integration context, parameters, response fields and usage notes for real-time market data workflows.
## GET /api/suspension/sse Debug Module
# GET /trade-tick Debug Module
Source: https://alltick.co/apis/en/api-reference/stock/debug/trade-tick
apis/api-reference/openapi.json GET /quote-stock-b-api/trade-tick
This page explains GET /trade-tick Debug Module for AllTick API, including integration context, parameters, response fields and usage notes for real-time market data workflows.
## GET /trade-tick Debug Module
# GET Order Book (Latest Depth / Order Book) Query
Source: https://alltick.co/apis/en/api-reference/stock/depth-tick
This documentation describes AllTick’s GET latest order book quotation API for stocks, which provides real-time bid-ask quotes and multi-level order book depth for US, Hong Kong, and China A-share markets, including full request URL, parameters, response fields, and frequency limits, enabling quant trading systems, market making engines, and terminals to integrate live order book data.
## GET /depth-tick
## Interface Description
The following is the maximum order book depth for each product type:
1. For inactive products, the available depth may be smaller than the maximum listed below. This is normal.
2. One side of the order book may be empty. For example, when a stock reaches its limit up or limit down price, one side of the order book may be empty.
| Item | Forex, Precious Metals, Crude Oil | Cryptocurrencies | Hong Kong Stocks | US Stocks | A Shares |
| - | - | - | - | - | - |
| Depth Description | Up to 1 level | Up to 5 levels | Up to 10 levels | Up to 1 level | Up to 5 levels |
## Request Frequency
| Plan | Individual Request | Multiple HTTP Interfaces Requested Together |
| - | - | - |
| Free | One request every 10 seconds | 1. Only one interface request every 10 seconds.
**2. When requesting multiple interfaces, note that /batch-kline requires a 10-second interval.**
3. All interfaces combined: maximum 10 requests per minute (one every 6 seconds).
4. Maximum 1,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Basic | One request per second | 1. Only one interface request in the same second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 3-second interval.**
3. All interfaces combined: maximum 60 requests per minute (one per second).
4. Maximum 86,400 requests per day; usage resumes after midnight the next day if exceeded. |
| Premium | Up to 10 requests per second | 1. All interfaces combined: up to 10 requests per second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 2-second interval.**
3. All interfaces combined: maximum 600 requests per minute (10 per second).
4. Maximum 864,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Professional | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All Hong Kong Stocks | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All A Shares | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All US Stocks | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
## Interface Limitations
1. Be sure to read: [HTTP Interface Restrictions](/apis/en/getting-started/http-interface-restrictions)
2. Be sure to read: [Error Code Description](/apis/en/getting-started/error-code-description)
## API Endpoints
**1. US Stocks, Hong Kong Stocks, A Shares, and Major Index Data:**
* Base Path: `/quote-stock-b-api/depth-tick`
* Full URL: [https://quote.alltick.co/quote-stock-b-api/depth-tick](https://quote.alltick.co/quote-stock-b-api/depth-tick)
**2. Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities:**
* Base Path: `/quote-b-api/depth-tick`
* Full URL: [https://quote.alltick.co/quote-b-api/depth-tick](https://quote.alltick.co/quote-b-api/depth-tick)
## Request Examples
**1. US Stocks, Hong Kong Stocks, A Shares, and Major Index Data:**
When sending a query request, include the method name and token information. Example:
[https://quote.alltick.co/quote-stock-b-api/depth-tick?token=your\_token\&query=queryData](https://quote.alltick.co/quote-stock-b-api/depth-tick?token=your_token\&query=queryData)
**2. Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities:**
When sending a query request, include the method name and token information. Example:
[https://quote.alltick.co/quote-b-api/depth-tick?token=your\_token\&query=queryData](https://quote.alltick.co/quote-b-api/depth-tick?token=your_token\&query=queryData)
## Request Parameters
| Name | Position | Type | Required | Description |
| - | - | - | - | - |
| token | query | string | No | |
| query | query | string | No | See the query request parameter description. |
## Query Request Parameters
URL-encode the following JSON and assign it to the `query` query string in the URL.
```json theme={null}
{
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"symbol_list": [
{
"code": "857.HK"
},
{
"code": "UNH.US"
}
]
}
}
```
| Name | Type | Required | Description |
| - | - | - | - |
| trace | string | Yes | |
| data | object | Yes | |
| » symbol\_list | \[object] | Yes | |
| »» code | string | No | Code. Select the code you want to query from the code list.
**Note: The code value is case-sensitive and must match the code in the product list.** |
## Response Example
```json theme={null}
{
"ret": 200,
"msg": "ok",
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"tick_list": [
{
"code": "857.HK",
"seq": "30686349",
"tick_time": "1677830357227",
"bids": [
{
"price": "136.424",
"volume": "100000.00"
}
],
"asks": [
{
"price": "136.427",
"volume": "400000.00"
}
]
}
]
}
}
```
## Response Result
| Status Code | Status Meaning | Description | Data Model |
| - | - | - | - |
| 200 | OK | OK | Inline |
| Name | Type | Required | Description |
| - | - | - | - |
| » ret | integer | true | Return code |
| » msg | string | true | Message corresponding to the return code |
| » trace | string | true | Request trace |
| » data | object | true | |
| »» tick\_list | \[object] | true | |
| »»» code | string | false | Code |
| »»» seq | string | false | Quote sequence number |
| »»» tick\_time | string | false | Quote timestamp |
| »»» bids | \[object] | false | Bid list |
| »»»» price | string | false | Price |
| »»»» volume | string | false | Volume |
| »»» asks | \[object] | false | Ask list |
| »»»» price | string | false | Price |
| »»»» volume | string | false | Volume.
1. Some CFD indices do not provide volume.
2. Forex, precious metals, energy, stocks, and cryptocurrencies all provide volume. |
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# GET Single-Product Historical K-Line Query (High, Low, Open, Close)
Source: https://alltick.co/apis/en/api-reference/stock/kline
Learn how to use AllTick stock HTTP API to query historical K-line and OHLC data for a single US stock, Hong Kong stock, China A-share or major index, with request parameters, URL examples and response fields.
## GET /kline
## **Interface Description**
This interface can be used to query historical K-lines, but each request can query only one product. **It is recommended to cache the queried historical K-lines in a local database.**
For customers using HTTP interfaces to obtain K-lines, we recommend using `/kline` together with `/batch-kline` as follows:
* First, use the `/kline` interface to poll historical data and store it in a local database. Later historical data can be obtained directly from the customer's database without making another interface request.
* Then, continuously use the `/batch-kline` interface to batch request the latest 2 K-lines for multiple products and update the database with the data.
This approach can quickly update the latest K-lines while avoiding frequency restrictions caused by frequent historical K-line requests.
## **Request Frequency**
| Plan | Individual Request | Requesting Multiple HTTP Interfaces at the Same Time |
| - | - | - |
| Free | One request every 10 seconds | 1. Only one interface can be requested every 10 seconds.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 10-second interval.**
3. All interfaces combined: maximum 10 requests per minute (one every 6 seconds).
4. Maximum 1,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Basic | One request per second | 1. Only one interface can be requested in the same second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 3-second interval.**
3. All interfaces combined: maximum 60 requests per minute (one per second).
4. Maximum 86,400 requests per day; usage resumes after midnight the next day if exceeded. |
| Premium | Up to 10 requests per second | 1. All interfaces combined: up to 10 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 2-second interval.**
3. All interfaces combined: maximum 600 requests per minute (10 per second).
4. Maximum 864,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Professional | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All Hong Kong Stocks | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All A Shares | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All US Stocks | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
## Interface Limitations
1. Be sure to read: [HTTP Interface Restrictions](/apis/en/getting-started/http-interface-restrictions)
2. Be sure to read: [Error Code Description](/apis/en/getting-started/error-code-description)
## API Endpoints
**1. US Stocks, Hong Kong Stocks, A Shares, and Major Index Data API Endpoint:**
* Base Path: `/quote-stock-b-api/kline`
* Full URL: [https://quote.alltick.co/quote-stock-b-api/kline](https://quote.alltick.co/quote-stock-b-api/kline)
**2. Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities API Endpoint:**
* Base Path: `/quote-b-api/kline`
* Full URL: [https://quote.alltick.co/quote-b-api/kline](https://quote.alltick.co/quote-b-api/kline)
## Request Examples
**1. Request example for US Stocks, Hong Kong Stocks, A Shares, and Major Index Data:**
When sending a query request, you must include the method name and token information. Example:
[https://quote.alltick.co/quote-stock-b-api/kline?token=your\_token\&query=queryData](https://quote.alltick.co/quote-stock-b-api/kline?token=your_token\&query=queryData)
**2. Request example for Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities:**
When sending a query request, you must include the method name and token information. Example:
[https://quote.alltick.co/quote-b-api/kline?token=your\_token\&query=queryData](https://quote.alltick.co/quote-b-api/kline?token=your_token\&query=queryData)
## Request Parameters
| Name | Position | Type | Required | Description |
| - | - | - | - | - |
| token | query | string | No | |
| query | query | string | No | See the query request parameter description. |
## Query Request Parameters
```json theme={null}
{
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {
"code": "857.HK",
"kline_type": 1,
"kline_timestamp_end": 0,
"query_kline_num": 2,
"adjust_type": 0
}
}
```
| Name | Type | Required | Description |
| - | - | - | - |
| trace | string | Yes | Trace code used for log lookup. Ensure it is unique for each request. |
| data | object | Yes | |
| » code | string | Yes | View the code list and select the code you want to query: \[Click the code list]
**Note: The code value must match the case of the code in the product list.** |
| » kline\_type | integer | Yes | K-line type:
1. 1 is 1-minute K-line, 2 is 5-minute K-line, 3 is 15-minute K-line, 4 is 30-minute K-line, 5 is hourly K-line, 6 is 2-hour K-line (stocks do not support 2-hour K-line), 7 is 4-hour K-line (stocks do not support 4-hour K-line), 8 is daily K-line, 9 is weekly K-line, and 10 is monthly K-line. Note: stocks do not support 2-hour or 4-hour K-lines.
2. The shortest supported K-line is 1 minute.
3. To query **yesterday's closing price**, pass 8 for kline\_type. |
| » kline\_timestamp\_end | integer | Yes | Query K-lines backward from the specified time.
1. Pass 0 to query K-lines backward from the latest trading day.
2. Pass a timestamp to query K-lines backward from that timestamp.
3. Only forex, precious metals, and cryptocurrencies support timestamp input; stock codes do not. |
| » query\_kline\_num | integer | Yes | 1. Indicates how many K-lines to query. Each request can query up to 500 K-lines, and you can loop backward by timestamp.
2. This field can be used to query **yesterday's closing price**: pass 8 for kline\_type and 2 for query\_kline\_num. Of the 2 returned K-line records, the one with the smaller timestamp is yesterday's closing price. |
| » adjust\_type | integer | Yes | Adjustment type. Effective only for stock codes. For example: 0: ex-rights, 1: forward-adjusted. Currently only 0 is supported. |
## Response Example
```json theme={null}
{
"ret": 200,
"msg": "ok",
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {
"code": "857.HK",
"kline_type": 1,
"kline_list": [
{
"timestamp": "1677829200",
"open_price": "136.421",
"close_price": "136.412",
"high_price": "136.422",
"low_price": "136.407",
"volume": "0",
"turnover": "0"
},
{
"timestamp": "1677829260",
"open_price": "136.412",
"close_price": "136.401",
"high_price": "136.415",
"low_price": "136.397",
"volume": "0",
"turnover": "0"
}
]
}
}
```
## Response Result
| Status Code | Status Meaning | Description | Data Model |
| - | - | - | - |
| 200 | OK | OK | Inline |
## Response Data Structure
| Name | Type | Required | Description |
| - | - | - | - |
| » ret | integer | true | |
| » msg | string | true | |
| » trace | string | true | |
| » data | object | true | |
| »» code | string | true | Code |
| »» kline\_type | integer | true | K-line type:
1. 1 is 1-minute K-line, 2 is 5-minute K-line, 3 is 15-minute K-line, 4 is 30-minute K-line, 5 is hourly K-line, 6 is 2-hour K-line (stocks do not support 2-hour K-line), 7 is 4-hour K-line (stocks do not support 4-hour K-line), 8 is daily K-line, 9 is weekly K-line, and 10 is monthly K-line. Note: stocks do not support 2-hour or 4-hour K-lines.
2. The shortest supported K-line is 1 minute. |
| »» kline\_list | \[object] | true | |
| »»» timestamp | string | true | Timestamp of the K-line |
| »»» open\_price | string | true | Opening price of the K-line |
| »»» close\_price | string | true | Closing price of the K-line:
1. During trading hours, for the latest K-line, this price is also the latest trade price.
2. During market closure, for the latest K-line, this price is the closing price. |
| »»» high\_price | string | true | Highest price of the K-line |
| »»» low\_price | string | true | Lowest price of the K-line |
| »»» volume | string | true | Trading quantity of the K-line |
| »»» turnover | string | true | Trading amount of the K-line |
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# Price Change, Market Closure, Holidays, Limit Up/Down, IPO and Delisting
Source: https://alltick.co/apis/en/api-reference/stock/price-change-trading-status
This page explains AllTick stock API fields for price change, market closure, holidays, limit up, limit down, IPO and delisting status so developers can parse trading calendars and market status correctly.
## Price Change Description
AllTick interfaces do not provide a price change or 24-hour price change field. Customers can calculate price changes themselves by obtaining AllTick data.
1. **Daily price change calculation methods**:
* **Method 1**: Use the HTTP interface to obtain today's daily K-line closing price and the previous day's daily K-line closing price. The formula is:
Price change = (today's closing price - previous day's closing price) / previous day's closing price \* 100%
* **Method 2**: Use the WebSocket interface to obtain the latest price, and use the HTTP interface to obtain the previous day's daily K-line closing price. The formula is:
Price change = (latest price - previous day's closing price) / previous day's closing price \* 100%
2. **24-hour price change calculation method**:
* Use the WebSocket latest trade price interface (request protocol number: 22004) to receive tick-by-tick trade prices in real time.
* You need to store the latest price from 24 hours ago that was pushed by the WebSocket interface for subsequent calculation.
* Formula:
24-hour price change = (latest price - latest price 24 hours ago) / latest price 24 hours ago \* 100%
## Market Closure or Trading Hours Description
AllTick does not provide an interface for market closures or trading hours. Customers can view the fixed trading hours of each product type in the [Product List](https://docs.google.com/spreadsheets/d/1avkeR1heZSj6gXIkDeBt8X3nv4EzJetw4yFuKjSDYtA/edit?gid=495387863#gid=495387863).
[Product List](https://docs.google.com/spreadsheets/d/1avkeR1heZSj6gXIkDeBt8X3nv4EzJetw4yFuKjSDYtA/edit?gid=495387863#gid=495387863)
## Holiday Description
AllTick does not provide a holiday interface. Holiday closure notices will be published in advance in our Telegram channels. Please refer to the Telegram channel notices for specific products that are closed during holidays, and follow the channels for the latest holiday closure notifications.
Chinese channel: [Telegram Channel](https://t.me/alltick_cn)
English channel: [Telegram Channel](https://t.me/alltick_en)
## Stock Limit Up/Down Description
AllTick does not provide an interface for judging limit up or limit down. Customers can judge whether a stock is limit up or limit down in the following way:
1. **Judgment based on order book interface data**: When subscribing to the order book interface, if only one side has data while the prices and volumes on the other side all return 0, it can be judged as limit up or limit down. The specific judgment method is as follows:
* If only the `bid` side has data and all `ask` prices and volumes return 0, the stock is limit up.
* If only the `ask` side has data and all `bid` prices and volumes return 0, the stock is limit down.
Below is a sample screenshot of the returned data:
## Stock Delisting Judgment Description
AllTick does not provide a delisting judgment interface. Customers can judge whether a stock has been delisted in the following way:
**Judgment method**: When subscribing to the order book interface, if the prices and volumes on both the `bid` and `ask` sides all return 0, it means the stock has been delisted.
Below is a sample screenshot of the returned data:
## IPO Description
AllTick does not provide an interface for judging IPOs. We regularly update the [Product List](https://docs.google.com/spreadsheets/d/1avkeR1heZSj6gXIkDeBt8X3nv4EzJetw4yFuKjSDYtA/edit?gid=495387863#gid=495387863) to reflect newly listed stocks and remove delisted stocks from the list.
Click the link below for the product list:
[Product List](https://docs.google.com/spreadsheets/d/1avkeR1heZSj6gXIkDeBt8X3nv4EzJetw4yFuKjSDYtA/edit?gid=495387863#gid=495387863)
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# GET Batch Query Stock Product Basic Information
Source: https://alltick.co/apis/en/api-reference/stock/static-info
This documentation describes AllTick’s GET stock basic information batch query API, which returns metadata such as symbol name, exchange, currency, and precision for multiple stocks, to be used together with realtime and historical data APIs so trading systems and terminals can display complete information for US, HK, and A-share securities.
## GET /static\_info
## Interface Description
This interface only supports batch requests for partial basic information of US stocks, Hong Kong stocks, and A-share products.
## **Request Frequency**
| Plan | Individual Request | Requesting Multiple HTTP Interfaces at the Same Time |
| - | - | - |
| Free | One request every 10 seconds | 1. Only one interface can be requested every 10 seconds.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 10-second interval.**
3. All interfaces combined: maximum 10 requests per minute (one every 6 seconds).
4. Maximum 1,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Basic | One request per second | 1. Only one interface can be requested in the same second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 3-second interval.**
3. All interfaces combined: maximum 60 requests per minute (one per second).
4. Maximum 86,400 requests per day; usage resumes after midnight the next day if exceeded. |
| Premium | Up to 10 requests per second | 1. All interfaces combined: up to 10 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 2-second interval.**
3. All interfaces combined: maximum 600 requests per minute (10 per second).
4. Maximum 864,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Professional | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All Hong Kong Stocks | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All A Shares | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All US Stocks | Up to 20 requests per second | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
## Interface Limitations
1. Be sure to read: [HTTP Interface Restrictions](/apis/en/getting-started/http-interface-restrictions)
2. Be sure to read: [Error Code Description](/apis/en/getting-started/error-code-description)
## **API Endpoint**
* **Base Path**: `/quote-stock-b-api/static_info`
* **Full URL**: `https://quote.alltick.co/quote-stock-b-api/static_info`
## **Request Example**
When sending a query request, you must include the method name and token information. Example:
```text theme={null}
https://quote.alltick.co/quote-stock-b-api/static_info?token=your_token&query=queryData
```
## Request Parameters
| Name | Position | Type | Required | Description |
| - | - | - | - | - |
| token | query | string | No | |
| query | query | string | No | See the query request parameter description. |
**URL-encode the following JSON and assign it to the query string parameter `query` in the URL.**
```json theme={null}
{
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"symbol_list": [
{
"code": "857.HK"
},
{
"code": "UNH.US"
}
]
}
}
```
## Query Request Parameters
| Name | Type | Required | Description |
| - | - | - | - |
| trace | string | Yes | |
| data | object | Yes | |
| » symbol\_list | \[object] | Yes | |
| »» code | string | No | Code: \[Click the code list]
**Note: The code value must match the case of the code in the product list.** |
## Response Example
```json theme={null}
{
"ret": 200,
"msg": "ok",
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"static_info_list": [
{
"board": "HKEquity",
"bps": "101.7577888985738336",
"circulating_shares": "9267359712",
"currency": "HKD",
"dividend_yield": "3.4558141358352833",
"eps": "13.7190213011686429",
"eps_ttm": "18.0567016900844671",
"exchange": "SEHK",
"hk_shares": "9267359712",
"lot_size": "100",
"name_cn": "Tencent Holdings",
"name_en": "TENCENT",
"name_hk": "Tencent Holdings",
"symbol": "700.HK",
"total_shares": "9267359712"
}
]
}
}
```
## Response Result
| Status Code | Status Meaning | Description | Data Model |
| - | - | - | - |
| 200 | OK | OK | Inline |
## Response Data Structure
| Name | Type | Required | Description |
| - | - | - | - |
| » ret | integer | true | Return code |
| » msg | string | true | Message corresponding to the return code |
| » trace | string | true | Request trace |
| » data | object | true | |
| »» static\_info\_list | \[object] | true | |
| »»» board | string | false | Stock board |
| »»» bps | string | false | Book value per share |
| »»» circulating\_shares | string | false | Circulating shares |
| »»» currency | string | false | Trading currency |
| »»» dividend\_yield | string | false | Dividend yield |
| »»» eps | string | false | Earnings per share |
| »»» eps\_ttm | string | false | Earnings per share (TTM) |
| »»» exchange | string | false | Exchange to which the product belongs |
| »»» hk\_shares | string | false | Hong Kong stock shares (Hong Kong stocks only) |
| »»» lot\_size | string | false | Shares per lot |
| »»» name\_cn | string | false | Simplified Chinese product name |
| »»» name\_en | string | false | English product name |
| »»» name\_hk | string | false | Traditional Chinese product name |
| »»» symbol | string | false | Product code |
| »»» total\_shares | string | false | Total shares |
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# GET Suspension and Resumption Information Query Interface
Source: https://alltick.co/apis/en/api-reference/stock/suspension
This page explains AllTick suspension and resumption query API for checking stock halt, resume and trading status information used by market data systems, risk controls and trading tools.
## GET /api/suspension
## Interface Description
This interface provides suspension and resumption information queries for major global exchanges (SSE, NYSE, NASDAQ). All interfaces return JSON data, sorted by announcement time in descending order.
## **Request Frequency**
| Plan | Individual Request for a Single Interface | Requesting Multiple HTTP Interfaces at the Same Time |
| - | - | - |
| Free | One request per minute | 1. Only one interface can be requested every 10 seconds.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 10-second interval.**
3. All interfaces combined: maximum 10 requests per minute (one every 6 seconds).
4. Maximum 1,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Basic | One request per minute | 1. Only one interface can be requested in the same second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 3-second interval.**
3. All interfaces combined: maximum 60 requests per minute (one per second).
4. Maximum 86,400 requests per day; usage resumes after midnight the next day if exceeded. |
| Premium | One request per minute | 1. All interfaces combined: up to 10 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 2-second interval.**
3. All interfaces combined: maximum 600 requests per minute (10 per second).
4. Maximum 864,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Professional | One request per minute | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All Hong Kong Stocks | One request per minute | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All A Shares | One request per minute | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All US Stocks | One request per minute | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that the /batch-kline interface requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
## Interface Limitations
1. Be sure to read: [HTTP Interface Restrictions](/apis/en/getting-started/http-interface-restrictions)
2. Be sure to read: [Error Code Description](/apis/en/getting-started/error-code-description)
## **API Endpoints**
**1. Query Shanghai Stock Exchange suspension and resumption information:**
* Base Path: `/api/suspension/sse`
* Full URL: [https://quote.alltick.co/api/suspension/sse](https://quote.alltick.co/api/suspension/sse)
**2. Query New York Stock Exchange suspension and resumption information:**
* Base Path: `/api/suspension/nyse`
* Full URL: [https://quote.alltick.co/api/suspension/nyse](https://quote.alltick.co/api/suspension/nyse)
**3. Query NASDAQ suspension and resumption information:**
* Base Path: `/api/suspension/nasdaq`
* Full URL: [https://quote.alltick.co/api/suspension/nasdaq](https://quote.alltick.co/api/suspension/nasdaq)
## **Request Examples**
### 1. Get SSE Data Interface
#### Interface Information
* **URL**: `/api/suspension/sse`
* **Method**: GET
* **Description**: Get all suspension and resumption information from the Shanghai Stock Exchange (SSE)
#### Request Parameters
| Field | Type | Required | Description |
| - | - | - | - |
| token | string | Yes | User subscription token |
| page | integer | No | Query page number |
| size | integer | No | Page size |
#### Response Example
```json theme={null}
{
"success": true,
"timestamp": "2024-01-15T10:30:00",
"totalCount": 125,
"data": [
{
"symbol": "600000",
"symbolName": "Shanghai Pudong Development Bank",
"haltReason": "Trading halt due to major matters",
"haltDate": "2024-01-15",
"haltTime": "09:30:00",
"haltPeriod": "Full-day trading halt",
"resumeDate": "2024-01-16",
"resumeTime": "09:30:00",
"publishDate": "2024-01-14 18:00:00"
}
]
}
```
#### Response Field Description
| Field | Type | Required | Description |
| - | - | - | - |
| » success | boolean | Yes | Whether the request was successful |
| » timestamp | string | Yes | Response timestamp (format: yyyy-MM-dd'T'HH:mm:ss) |
| » totalCount | integer | Yes | Total number of records |
| » data | array | Yes | Suspension and resumption information list |
| » totalPages | integer | No | Total number of pages (returned for paginated queries) |
| » currentPage | integer | No | Current page (returned for paginated queries) |
| » currentSize | integer | No | Number of records on the current page (returned for paginated queries) |
#### data Field (Object in the Suspension and Resumption Information List)
| Field | Type | Nullable | Description |
| - | - | - | - |
| » symbol | string | No | Stock code |
| » symbolName | string | Yes | Stock name |
| » haltReason | string | Yes | Suspension reason |
| » haltDate | string | Yes | Suspension date |
| » haltTime | string | Yes | Suspension time |
| » haltPeriod | string | Yes | Suspension period |
| » resumeDate | string | Yes | Resumption date |
| » resumeTime | string | Yes | Resumption time |
| » publishDate | string | No | Announcement time |
#### Call Example
```bash theme={null}
curl -X GET "https://quote.alltick.co/api/suspension/sse?token=your_token&page=1&size=10" -H "Accept: application/json"
```
***
### 2. Get NYSE Data Interface
#### Interface Information
* **URL**: `/api/suspension/nyse`
* **Method**: GET
* **Description**: Get all suspension and resumption information from the New York Stock Exchange (NYSE)
#### Request Parameters
| Field | Type | Required | Description |
| - | - | - | - |
| token | string | Yes | User subscription token |
| page | integer | No | Query page number |
| size | integer | No | Page size |
#### Response Example
```json theme={null}
{
"success": true,
"timestamp": "2024-01-15T10:30:00",
"totalCount": 89,
"data": [
{
"symbol": "AAPL",
"haltReason": "News pending",
"haltDate": "2024-01-15",
"haltTime": "10:15:00",
"haltDateTime": "2024-01-15 10:15:00",
"resumeDate": "2024-01-15",
"resumeTime": "11:00:00",
"resumeDateTime": "2024-01-15 11:00:00",
"sourceExchange": "NYSE",
"publishDate": "2024-01-15 10:10:00"
}
]
}
```
#### Response Field Description
| Field | Type | Required | Description |
| - | - | - | - |
| » success | boolean | Yes | Whether the request was successful |
| » timestamp | string | Yes | Response timestamp (format: yyyy-MM-dd'T'HH:mm:ss) |
| » totalCount | integer | Yes | Total number of records |
| » data | array | Yes | Suspension and resumption information list |
| » totalPages | integer | No | Total number of pages (returned for paginated queries) |
| » currentPage | integer | No | Current page (returned for paginated queries) |
| » currentSize | integer | No | Number of records on the current page (returned for paginated queries) |
#### data Field (Object in the Suspension and Resumption Information List)
| Field | Type | Nullable | Description |
| - | - | - | - |
| » symbol | string | No | Stock code |
| » symbolName | string | Yes | Stock name |
| » haltReason | string | Yes | Suspension reason |
| » haltTime | string | Yes | Suspension time |
| » haltDateTime | string | Yes | Suspension date and time |
| » resumeDate | string | Yes | Resumption date |
| » resumeTime | string | Yes | Resumption time |
| » resumeDateTime | string | Yes | Resumption date and time |
| » sourceExchange | string | Yes | Exchange code |
| » publishDate | string | No | Announcement time |
#### Call Example
```bash theme={null}
curl -X GET "https://quote.alltick.co/api/suspension/nyse?token=your_token&page=1&size=10" -H "Accept: application/json"
```
***
### 3. Get NASDAQ Data Interface
#### Interface Information
* **URL**: `/api/suspension/nasdaq`
* **Method**: GET
* **Description**: Get all suspension and resumption information from NASDAQ
#### Request Parameters
| Field | Type | Required | Description |
| - | - | - | - |
| token | string | Yes | User subscription token |
| page | integer | No | Query page number |
| size | integer | No | Page size |
#### Response Example
```json theme={null}
{
"success": true,
"timestamp": "2024-01-15T10:30:00",
"totalCount": 156,
"data": [
{
"symbol": "GOOGL",
"haltDate": "2024-01-15",
"haltTime": "13:45:00",
"haltDateTime": "2024-01-15 13:45:00",
"sourceExchange": "NASDAQ",
"haltReason": "Volatility halt",
"pauseThresholdPrice": "145.50",
"resumeDate": "2024-01-15",
"resumeTime": "14:00:00",
"resumeDateTime": "2024-01-15 14:00:00",
"publishDate": "2024-01-15 13:44:30"
}
]
}
```
#### Response Field Description
| Field | Type | Required | Description |
| - | - | - | - |
| » success | boolean | Yes | Whether the request was successful |
| » timestamp | string | Yes | Response timestamp (format: yyyy-MM-dd'T'HH:mm:ss) |
| » totalCount | integer | Yes | Total number of records |
| » data | array | Yes | Suspension and resumption information list |
| » totalPages | integer | No | Total number of pages (returned for paginated queries) |
| » currentPage | integer | No | Current page (returned for paginated queries) |
| » currentSize | integer | No | Number of records on the current page (returned for paginated queries) |
#### data Field (Object in the Suspension and Resumption Information List)
| Field | Type | Nullable | Description |
| - | - | - | - |
| » symbol | string | No | Stock code |
| » symbolName | string | Yes | Stock name |
| » haltDate | string | Yes | Suspension date |
| » haltTime | string | Yes | Suspension time |
| » haltDateTime | string | Yes | Suspension date and time |
| » sourceExchange | string | Yes | Exchange code |
| » haltReason | string | Yes | Suspension reason |
| » pauseThresholdPrice | string | Yes | Pause threshold price |
| » resumeDate | string | Yes | Resumption date |
| » resumeTime | string | Yes | Quote resumption time |
| » resumeDateTime | string | Yes | Trading resumption time |
| » publishDate | string | No | Announcement time |
#### Call Example
```bash theme={null}
curl -X GET "https://quote.alltick.co/api/suspension/nasdaq?token=your_token&page=1&size=10" -H "Accept: application/json"
```
***
### Error Response
All interfaces return the following format when an error occurs:
```json theme={null}
{
"success": false,
"error": "Error description information"
}
```
**HTTP Status Code**: 500
#### Error Response Field Description
| Field | Type | Required | Description |
| - | - | - | - |
| success | boolean | Yes | Whether the request was successful. Fixed as false. |
| error | string | Yes | Error description information |
***
### Notes
1. All interfaces do not support pagination and return the full data for the most recent year.
2. Data is sorted by announcement time in descending order (latest first).
3. Time formats in the response:
* timestamp field: ISO format (**yyyy-MM-dd'T'HH:mm:ss**)
* Other time fields: **yyyy-MM-dd HH:mm:ss**
4. It is recommended to set an appropriate timeout. Large data volumes may require more time.
5. Empty field descriptions:
* **"No": the field always has a value and will not be null.**
* **"Yes": the field may be null or an empty string. The caller must handle empty values.**
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# GET Latest Trade Price (Latest Tick / Current Price / Latest Price) Batch Query
Source: https://alltick.co/apis/en/api-reference/stock/trade-tick
This documentation page describes AllTick’s GET latest transaction price batch query API, which returns the latest trade prices (latest tick, latest price) for multiple US, Hong Kong, and China A-share stocks and major indices in one HTTP request, including request frequency limits, example URLs, parameters, and response schema, making it easy for quantitative trading platforms, dashboards, and financial apps to integrate low-latency real-time stock price data.
## GET /trade-tick
## Interface Description
This interface supports batch requests for the latest trade price of products (latest tick data, also the current price or latest price). It does not support requests for historical trade prices (historical tick data).
## Request Frequency
| Plan | Individual Request | Multiple HTTP Interfaces Requested Together |
| - | - | - |
| Free | 1. One request every 10 seconds.
2. Up to 5 products can be queried in one batch. | 1. Only one interface request every 10 seconds.
**2. When requesting multiple interfaces, note that /batch-kline requires a 10-second interval.**
3. All interfaces combined: maximum 10 requests per minute (one every 6 seconds).
4. Maximum 1,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Basic | 1. One request per second.
2. Due to GET URL length limits, a maximum of 50 codes per request is recommended. | 1. Only one interface request in the same second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 3-second interval.**
3. All interfaces combined: maximum 60 requests per minute (one per second).
4. Maximum 86,400 requests per day; usage resumes after midnight the next day if exceeded. |
| Premium | 1. Up to 10 requests per second.
2. Due to GET URL length limits, a maximum of 50 codes per request is recommended. | 1. All interfaces combined: up to 10 requests per second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 2-second interval.**
3. All interfaces combined: maximum 600 requests per minute (10 per second).
4. Maximum 864,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Professional | 1. Up to 20 requests per second.
2. Due to GET URL length limits, a maximum of 50 codes per request is recommended. | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All Hong Kong Stocks | 1. Up to 20 requests per second.
2. Due to GET URL length limits, a maximum of 50 codes per request is recommended. | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All A Shares | 1. Up to 20 requests per second.
2. Due to GET URL length limits, a maximum of 50 codes per request is recommended. | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All US Stocks | 1. Up to 20 requests per second.
2. Due to GET URL length limits, a maximum of 50 codes per request is recommended. | 1. All interfaces combined: up to 20 requests per second.
**2. When requesting multiple interfaces, note that /batch-kline requires a 1-second interval.**
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
## Interface Limitations
1. Be sure to read: [HTTP Interface Restrictions](/apis/en/getting-started/http-interface-restrictions)
2. Be sure to read: [Error Code Description](/apis/en/getting-started/error-code-description)
## API Endpoints
**1. US Stocks, Hong Kong Stocks, A Shares, and Major Index Data:**
* Base Path: `/quote-stock-b-api/trade-tick`
* Full URL: [https://quote.alltick.co/quote-stock-b-api/trade-tick](https://quote.alltick.co/quote-stock-b-api/trade-tick)
**2. Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities:**
* Base Path: `/quote-b-api/trade-tick`
* Full URL: [https://quote.alltick.co/quote-b-api/trade-tick](https://quote.alltick.co/quote-b-api/trade-tick)
## Request Examples
**1. US Stocks, Hong Kong Stocks, A Shares, and Major Index Data:**
When sending a query request, include the method name and token information. Example:
[https://quote.alltick.co/quote-stock-b-api/trade-tick?token=your\_token\&query=queryData](https://quote.alltick.co/quote-stock-b-api/trade-tick?token=your_token\&query=queryData)
**2. Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities:**
When sending a query request, include the method name and token information. Example:
[https://quote.alltick.co/quote-b-api/trade-tick?token=your\_token\&query=queryData](https://quote.alltick.co/quote-b-api/trade-tick?token=your_token\&query=queryData)
## Request Parameters
| Name | Position | Type | Required | Description |
| - | - | - | - | - |
| token | query | string | No | |
| query | query | string | No | See the query request parameter description. |
## Query Request Parameters
URL-encode the following JSON and assign it to the `query` query string in the URL.
```json theme={null}
{
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"symbol_list": [
{
"code": "857.HK"
},
{
"code": "UNH.US"
}
]
}
}
```
| Name | Type | Required | Description |
| - | - | - | - |
| trace | string | Yes | |
| data | object | Yes | |
| » symbol\_list | \[object] | Yes | |
| »» code | string | No | Code. Select the code you want to query from the code list.
**Note: The code value is case-sensitive and must match the code in the product list.** |
## Response Example
```json theme={null}
{
"ret": 200,
"msg": "ok",
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"tick_list": [
{
"code": "857.HK",
"seq": "30841439",
"tick_time": "1677831545217",
"price": "136.302",
"volume": "0",
"turnover": "0",
"trade_direction": 0
}
]
}
}
```
## Response Result
| Status Code | Status Meaning | Description | Data Model |
| - | - | - | - |
| 200 | OK | OK | Inline |
## Response Data Structure
| Name | Type | Required | Description |
| - | - | - | - |
| » ret | integer | true | Return code |
| » msg | string | true | Message corresponding to the return code |
| » trace | string | true | Request trace |
| » data | object | true | |
| »» tick\_list | \[object] | true | |
| »»» code | string | false | Code |
| »»» seq | string | false | Sequence number |
| »»» tick\_time | string | false | Timestamp |
| »»» price | string | false | Trade price |
| »»» volume | string | false | Trade volume |
| »»» turnover | string | false | Turnover |
| »»» trade\_direction | integer | false | Trade direction:
1. 0 is the default value, 1 is Buy, and 2 is Sell.
2. Forex, precious metals, and energy return 1 by default.
3. Stocks and cryptocurrencies may return 0, 1, or 2 depending on market conditions.
4. Details:
0: Neutral, meaning the trade was matched at a price between the best bid and best ask.
1: Aggressive buy, meaning the trade was executed at the ask price or higher.
2: Aggressive sell, meaning the trade was executed at the bid price or lower. |
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# Basic Usage
Source: https://alltick.co/apis/en/faqs/basic-usage
This FAQ answers Basic Usage, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
# Can I use AllTick data for commercial purposes?
Source: https://alltick.co/apis/en/faqs/basic-usage/can-i-use-allticks-data-for-commercial-purposes
This FAQ answers Can I use AllTick data for commercial purposes?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
According to information provided on the AllTick website, AllTick aims to offer real-time and historical financial market data to developers, fintech companies, traders, fund companies, exchanges, trading platforms, researchers, and research institutions. This indicates that AllTick's data services are designed to meet a variety of needs, including commercial purposes.
However, the specific terms of using AllTick data, including whether it can be used for commercial purposes, are usually specified in its terms of service or license agreement. These terms may detail the scope of data use, restrictions, and any related fees or subscription requirements.
#### Suggested Steps Include:
* **Review the Terms of Service**: Visit AllTick's official website and carefully read the terms of service, data usage policy, and license agreement to understand the specific provisions regarding data use.
* **Check Subscription Plans**: Different subscription plans might offer varying levels of data access rights and usage rights. Review these plans to see which one best fits your commercial needs.
* **Contact Customer Support**: If the information in the terms of service is not clear enough, or if you have a specific use case you'd like to discuss, directly contact AllTick's customer support team for more specific guidance.
* **Comply with Laws and Regulations**: Ensure that your use complies with all applicable laws, regulations, and industry standards, especially those concerning data privacy and intellectual property rights.
When using data from AllTick or any other data provider in a commercial setting, it's important to ensure that your use is legal, compliant, and in accordance with the provider's terms of use. This not only helps avoid potential legal issues but is also key to maintaining a good relationship with the data provider.
# Does AllTick provide real-time or delayed data?
Source: https://alltick.co/apis/en/faqs/basic-usage/does-alltick-provide-real-time-or-delayed-data
This FAQ answers Does AllTick provide real-time or delayed data?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
AllTick provides real-time financial market data, focusing on offering both real-time and historical data support to developers, fintech companies, traders, fund companies, exchanges, trading platforms, researchers, and research institutions. This includes data across multiple asset categories such as forex, stocks, commodities, and cryptocurrencies.
Real-time data is crucial for market analysis, trading decisions, and risk management, especially in the fast-changing financial markets. AllTick delivers ultra-low latency real-time data streams via technologies like WebSocket, ensuring users receive accurate and timely market information. This real-time capability is particularly suited for traders and applications that need to quickly respond to market changes.
Additionally, AllTick provides historical data, which is equally important for analyzing market trends, back-testing trading strategies, and more. By combining real-time and historical data, users gain a comprehensive view of the market, enabling them to better formulate and adjust their trading and investment decisions.
In summary, AllTick aims to support a wide range of financial analysis and trading activities by providing real-time and historical financial market data, meeting the needs of various users.
# Does AllTick API have request limitations?
Source: https://alltick.co/apis/en/faqs/basic-usage/does-allticks-api-have-request-limitations
This FAQ answers Does AllTick API have request limitations?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Most API services, including those providing financial market data like AllTick, set certain request limits to ensure the stability and fairness of the service. These limitations can include:
#### Rate Limiting
* Rate limiting refers to the maximum number of requests allowed within a certain timeframe. For example, AllTick might limit the number of requests a client can make per minute or per second. Exceeding this limit may result in requests being temporarily denied.
#### Concurrency Limits
* Concurrency limits refer to the maximum number of requests that can be processed simultaneously. This means if there are too many concurrent requests, some requests may be queued for processing, or in extreme cases, denied.
#### Data Volume Limits
* There might also be limitations on the volume of data returned. For instance, there might be a cap on the number of data points returned in a single request, or the total volume of data that can be downloaded within a specific timeframe might be restricted.
#### Access Level Restrictions
* Depending on the subscription plan, users may have different levels of access to the API. Paid users usually enjoy higher request limits and broader data access rights.
#### How to Address Request Limits:
* **Upgrade Subscription**: If your needs exceed the current request limits, consider upgrading to a higher-tier subscription plan.
Regarding AllTick's API request limits, the most accurate information will come directly from AllTick's official documentation or customer service. Understanding these limitations and planning your data request strategy before starting extensive use is very important. If you encounter issues related to limits while using the service, contacting AllTick's customer support team for assistance and advice is usually a good idea.
# How do I contact AllTick customer support?
Source: https://alltick.co/apis/en/faqs/basic-usage/how-to-contact-alltick-customer-support
This FAQ answers How do I contact AllTick customer support?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
To contact AllTick's customer support, there are several methods you can try, although the specific contact options should be based on the latest information provided on the AllTick website. Here are some common ways to reach customer support:
#### Official Website
* Visit AllTick's official website at [https://alltick.co](https://alltick.co) and look for the "Contact Us" or "Customer Support" section. Typically, the website will provide a contact form, email address, or customer service hotline number.
#### Email
* If a customer support email address is provided on the website, you can contact them directly via email. In your message, clearly describe your issue or needs and provide any relevant account information (excluding sensitive details like passwords) to help them process your request more efficiently.
#### Social Media
* Some companies also offer customer support services through social media platforms (like Twitter, LinkedIn). You can try sending a private message or mentioning their official account on these platforms to seek assistance.
#### Help Center or FAQ
* Before contacting customer support, it's advisable to check the Help Center or Frequently Asked Questions (FAQ) section provided by AllTick. Often, your question might already have a standard answer, allowing for quicker resolution.
#### Direct Phone Call
* If a customer service hotline number is provided, direct phone contact can often result in the fastest response. Prepare your question description and any necessary account information in advance, so you can provide them as soon as the call is connected.
Please note that response times may vary based on your geographic location and AllTick's operational hours. After sending your request, please be patient; the customer support team will reply as soon as possible within their working hours.
Since I can't access websites in real-time to retrieve the latest contact information, the above suggestions are based on generic customer support contact methods. It's recommended to directly visit AllTick's official website to obtain the most accurate contact information.
# How do I integrate AllTick data into my application?
Source: https://alltick.co/apis/en/faqs/basic-usage/how-to-integrate-alltick-data-into-my-application
This FAQ answers How do I integrate AllTick data into my application?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Integrating AllTick data into your application typically involves the following key steps:
1. **Obtain an API Key**: First, you need to register for an AllTick account and obtain an API key. The API key serves as your credential to access AllTick data, ensuring your requests are authenticated properly.
2. **Read the API Documentation**: Before starting to code, carefully read the API documentation provided by AllTick. The documentation will detail how to use the API, including available data types, request formats, response structures, and any limitations or requirements.
3. **Choose a Programming Language**: Select the appropriate programming language based on your development environment and preferences. AllTick usually supports multiple languages, such as Python, JavaScript, Java, etc., ensuring you can work in your most familiar environment.
4. **Write Code**: Write code using the programming language of your choice to call AllTick's API endpoints. You will need to include your API key in the request and specify the required parameters and data formats as directed by the API documentation.
5. **Handle Response Data**: Process the data returned by the API. Depending on your application's needs, you may need to parse the response in JSON or another format, extract the necessary information, and integrate it into your application.
6. **Test and Debug**: Conduct thorough testing during the integration process to ensure data is being pulled and displayed correctly. Be prepared to handle any errors and exceptions that may arise.
7. **Comply with Terms of Use**: Ensure your application complies with AllTick's terms of use, including but not limited to limitations on request frequency, data usage, and distribution policies.
8. **Stay Updated**: As AllTick's services are updated and improved, periodically check the API documentation for new features or changes, ensuring your application can fully utilize the latest data and services.
By following these steps, you can effectively integrate financial market data provided by AllTick into your application, offering your users real-time, accurate market information.
# How do I obtain an API key from AllTick?
Source: https://alltick.co/apis/en/faqs/basic-usage/how-to-obtain-an-api-key-from-alltick
This FAQ answers How do I obtain an API key from AllTick?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Obtaining an API key from AllTick typically involves the following steps:
1. **Register an Account**: Visit the official AllTick website and find the registration page. Fill in the necessary information, such as your name, email address, and password, to complete the account creation process.
2. **Log In to Your Account**: Log in to AllTick using the account information you just registered.
3. **Access API Management**: After logging in, navigate to the API management or API key management page. This is usually found in the account settings or developer tools section.
4. **Generate an API Key**: On the API management page, you will typically find an option to generate an API key. Click to generate a key, and the system will create a unique API key for you.
5. **Save Your API Key**: Once generated, make sure to save your API key securely. Note that to protect your data security, you should not share your API key with others and back it up in a secure location.
6. **Start Using**: With an API key in hand, you can begin using the API to make data calls, following the documentation and guides provided by AllTick.
Please note that the specific steps may vary depending on the design and user interface of the AllTick website. If you encounter any issues while obtaining your API key, it's recommended to consult AllTick's help documentation or directly contact customer support for assistance.
# How do I report data issues or API malfunctions?
Source: https://alltick.co/apis/en/faqs/basic-usage/how-to-report-data-issues-or-api-malfunctions
This FAQ answers How do I report data issues or API malfunctions?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
\
Before reporting an issue, it's crucial to gather and organize detailed information about the problem as much as possible, including, but not limited to:
#### Collect Detailed Information
* **Specific time and date** when the issue occurred.
* **Affected API endpoint (URL)**.
* **Example of the request sent** (ensure any sensitive information, such as API keys, is removed).
* **Response received**, including error codes and messages (if any).
* **Steps to reproduce the issue** (if possible).
#### Review Documentation and Community
* Before directly reporting, review AllTick’s official documentation, FAQs, or developer community to see if there are already solutions or if other users have encountered the same issue.
#### Report Through Official Channels
* Report the issue using the official contact methods provided by AllTick, which might include:
* Submitting through the "Contact Us" form provided on the official website.
* Sending a detailed description of the issue to the official customer support or technical support email.
* If a issue tracking system or support ticket system is provided, create a new support request following the guidelines.
#### Provide Necessary Support Information
* When reporting the issue, provide all relevant information collected in the first step to help the technical team quickly identify and solve the problem.
#### Track and Update
* If your issue is accepted for processing, track the status of the issue with the tracking number or ticket number provided. Provide updates promptly if more information is needed during the resolution process.
#### Leverage Community Power
* If AllTick has a developer forum or community, consider posting there as well. Sometimes, community members can offer useful insights or solutions.
When reporting an issue, maintaining professionalism and courtesy in communication is crucial, even if the problem may have impacted your work. Technical support teams are more inclined to assist users who provide detailed information and show a willingness to cooperate. Moreover, reporting problems through official channels not only helps get your issue resolved more quickly but also aids in improving the product and service.
# What is AllTick's data update frequency?
Source: https://alltick.co/apis/en/faqs/basic-usage/what-is-the-data-update-frequency-of-alltick
This FAQ answers What is AllTick's data update frequency?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
AllTick provides financial market data with very high update frequencies to ensure users can receive accurate and real-time market information. The specific data update frequency may vary depending on the type of data:
* **Forex (Foreign Exchange) Data**: Might be updated multiple times per second, as the forex market is extremely active with frequent price movements.
* **Commodities Data**: Depending on the market and the specific commodity, the update frequency might also be multiple times per second.
* **Stocks Data**: During trading hours, stock data is typically updated in real-time, with update frequencies that can reach multiple times per second.
* **Cryptocurrencies Data**: Given the 24/7 continuous trading nature of the cryptocurrency market, data updates are also in real-time, potentially multiple times per second.
AllTick aims to provide ultra-low latency real-time data streams through technologies like WebSocket, with an average latency of just about 170 milliseconds, ensuring users can receive accurate and timely market data. This high-frequency update is crucial for traders and analysts who need real-time data to make quick trading decisions.
Please note that the specific data update frequency may be influenced by various factors, including market activity, data source, and the performance of the technical platform. For the most accurate information, it's recommended to directly refer to the official documentation provided by AllTick or contact customer service.
# What programming languages does AllTick support for API calls?
Source: https://alltick.co/apis/en/faqs/basic-usage/what-programming-languages-does-alltick-support-for-api-calls
This FAQ answers What programming languages does AllTick support for API calls?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
According to the content on the AllTick website, AllTick supports multiple client development languages, enabling developers to make API calls using the technologies they are familiar with. These languages include, but are not limited to:
* **Python**
* **Go**
* **JavaScript**
* **Java**
The support for these languages ensures that developers can easily integrate AllTick's financial market data APIs across different platforms and environments, whether it's in web development, desktop applications, or mobile applications. By providing cross-language client libraries and quick-start example codes, AllTick aims to help developers get started quickly without spending a lot of time on integration work.
Furthermore, AllTick emphasizes the ease of use of its API, indicating that developers can create applications with any major client development language. This means no longer being restricted to specific programming languages like C++ or Java. Such flexibility ensures wide applicability and convenience, allowing more developers to utilize AllTick's data services to build innovative trading and analysis tools.
Please note that specific implementation details, client libraries, and sample codes can be found in AllTick's official documentation or GitHub page, providing developers with more detailed guidance and support.
# What types of financial data does AllTick provide?
Source: https://alltick.co/apis/en/faqs/basic-usage/what-types-of-financial-data-does-alltick-provide
This FAQ answers What types of financial data does AllTick provide?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
AllTick offers extensive financial market data, encompassing but not limited to the following types:
#### Forex Data
* Covers real-time and historical data for over 1,000 currency pairs, including major pairs, cross pairs, and foreign exchange rates.
#### Commodities Data
* Provides real-time and historical price data for commodities, including precious metals (such as gold and silver) and energy (such as crude oil and natural gas).
#### Stocks Data
* Encompasses real-time and historical data for over 170,000 U.S. and Hong Kong stocks, including information on stock prices, trading volumes, and market capitalization.
#### Cryptocurrencies Data
* Offers real-time and historical data from all major cryptocurrency exchanges, including price and trading information for popular cryptocurrencies like Bitcoin and Ethereum.
#### Global Stock Indices Data
* Includes real-time and historical data for major stock indices, covering stock market indices worldwide, such as the Dow Jones Industrial Average, NASDAQ Composite, S\&P 500 Index. Provides information on indices' price trends, trading volumes, and market capitalization.
AllTick aims to provide accurate, fast, and reliable data access solutions for developers, fintech companies, traders, fund companies, exchanges, trading platforms, researchers, and research institutions, supporting a wide range of financial market analysis and decision-making needs.
# Data Usage and Technical Issues
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues
This FAQ answers Data Usage and Technical Issues, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
# Does AllTick provide data analysis and visualization tools?
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues/does-alltick-provide-data-analysis-and-visualization-tools
This FAQ answers Does AllTick provide data analysis and visualization tools?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
AllTick focuses on providing real-time and historical financial market data APIs, but does not directly offer data analysis and visualization tools. However, acquiring accurate and timely financial data is foundational for effective data analysis and creating insightful visualizations. For users needing data analysis and visualization, consider integrating AllTick's data with other data analysis and visualization tools. Here are some recommended providers and capabilities to assist in your data analysis and visualization efforts:
#### Data Analysis Tools
* **Python**: Python is a widely-used programming language with powerful data analysis libraries such as Pandas, NumPy, and SciPy. It's suitable for data cleaning, transformation, statistical analysis, and machine learning.
* **R Language**: R is another programming language focused on statistical analysis, boasting a rich set of data manipulation, modeling, and visualization packages. It is particularly suited for complex statistical analysis and data exploration.
#### Data Visualization Tools
* **Tableau**: Tableau is a user-friendly business intelligence and data visualization tool that allows users to quickly create complex and interactive data visualizations.
* **Power BI**: Developed by Microsoft, Power BI is a robust data analysis and business intelligence platform that supports transforming data into easily understandable charts and reports.
* **Matplotlib and Seaborn**: These two Python libraries offer a wide range of chart and visualization types, suitable for creating static, animated, and interactive visualizations in the Python environment.
#### Development and Integration Tools
* **Jupyter Notebook**: Jupyter Notebook is an open-source web application that allows the creation and sharing of documents containing live code, equations, visualizations, and narrative text.
* **D3.js**: D3.js is a JavaScript library for creating complex data visualizations with web standards. It allows data-driven manipulations of the document and is a powerful tool for creating interactive web visualizations.
#### Usage Suggestions
* **Data Preprocessing**: Use Python or R for data cleaning and preprocessing before analysis and visualization to ensure data quality.
* **Choose the Right Tools**: Select the appropriate analysis and visualization tools based on your specific needs and technical background. For example, non-programming professionals might prefer Tableau or Power BI.
* **Learning and Community Resources**: Utilize online tutorials, courses, and community forums to learn best practices in data analysis and visualization.
While AllTick does not directly provide data analysis and visualization tools, by combining its data with the above tools and techniques, users can effectively conduct data analysis and create in-depth market insights.
# Does AllTick provide historical data query?
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues/does-alltick-provide-historical-data-query
This FAQ answers Does AllTick provide historical data query?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Yes, AllTick provides a historical data query service. AllTick offers not only real-time financial market data but also historical data for various asset classes, including forex, stocks, commodities, and cryptocurrencies. This enables users to access past market data for historical trend analysis, backtesting trading strategies, market research, and various other applications.
#### How to Query Historical Data with AllTick:
* **Consult the API Documentation**: First, visit AllTick's official API documentation. The documentation should detail how to construct requests to query historical data, including available parameters, time ranges, data formats, etc.
* **Obtain an API Key**: To use AllTick's API, you may need a valid API key. Typically, you can obtain the key after registering and logging into your AllTick account, from the account management or API settings page.
* **Construct the Request**: Following the guidance in the API documentation, construct your request using your programming language and tools (such as Python, cURL, etc.). Ensure the request includes the correct endpoint address, required historical time range, and other necessary parameters.
* **Send the Request and Process the Response**: Send your request to AllTick's servers and process the data upon receiving a response. Depending on your needs, further parsing and transformation of the data may be required.
* **Data Analysis and Application**: Once you have obtained the required historical data, you can begin data analysis. This may include calculating statistical indicators, plotting historical trends, conducting strategy backtests, etc.
#### Considerations:
* **Data Coverage Range**: Determine the time range and market or assets covered by AllTick's historical data. Different data products may have different historical depths.
* **Request Limitations**: Be aware of the limitations on API use, including request frequency and data volume limits. Ensure your data queries comply with these limitations to avoid service interruptions.
* **Data Accuracy**: While AllTick strives to provide accurate data, the reliability and accuracy of the data source still need to be considered when using historical data for analysis and decision-making.
If you encounter any issues while querying historical data, it is recommended to contact AllTick's customer support team for assistance.
# Does AllTick API support batch requests?
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues/does-allticks-api-support-batch-requests
This FAQ answers Does AllTick API support batch requests?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Yes, AllTick's API supports batch requests. This means you can request multiple data points or perform multiple operations within a single API call, thus enhancing data processing efficiency and reducing network latency. Batch requests are particularly useful in scenarios requiring a large amount of financial data from AllTick, such as obtaining historical prices for multiple stocks or querying real-time exchange rates for multiple currency pairs simultaneously.
#### How to Use Batch Requests:
* **Read the API Documentation**: Thoroughly review the API documentation provided by AllTick to understand the specific implementation method for batch requests, including how to construct the request body, the supported maximum request volume, and how to handle response data.
* **Obtain an API Key**: Ensure you have a valid AllTick API key. Typically, you need to register on the AllTick platform and create an application to obtain an API key.
* **Construct Batch Requests**: Following the guidance in the API documentation, construct batch requests using your programming language. This may involve creating a JSON object containing multiple request parameters.
* **Send Requests and Process Responses**: Use an appropriate HTTP client to send the batch request to AllTick's API endpoint, and parse the data upon receiving a response. Depending on the API's design, the response may include an array, with each element corresponding to an individual request in the batch.
* **Error Handling**: When processing the response of a batch request, be sure to check the success or error status of each individual request. The API documentation should provide guidance on how to identify and handle possible errors.
#### Considerations:
* **Rate Limiting**: Even batch requests are subject to the rate limits of the AllTick API. Ensure your request frequency does not exceed the platform's limits.
* **Performance Optimization**: While batch requests can reduce network latency, extensive data processing may impact client performance. Optimize data processing logic appropriately to ensure application responsiveness.
* **Data Update Frequency**: Considering the real-time data requirements, schedule the frequency of batch requests reasonably to ensure access to the latest data while avoiding unnecessary requests.
* By supporting batch requests, AllTick's API offers developers an efficient way to obtain and process a large volume of financial data, helping developers build feature-rich and responsive financial applications.
# How can I get real-time notifications and alerts on specific financial markets?
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues/how-can-i-get-real-time-notifications-and-alerts-on-specific-financial-markets
This FAQ answers How can I get real-time notifications and alerts on specific financial markets?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
AllTick focuses on providing real-time and historical financial market data APIs, but does not directly offer data analysis and visualization tools. However, acquiring accurate and timely financial data is foundational for effective data analysis and creating insightful visualizations. For users needing data analysis and visualization, consider integrating AllTick's data with other data analysis and visualization tools. Here are some recommended providers and capabilities to assist in your data analysis and visualization efforts:
#### Data Analysis Tools
* **Python**: Python is a widely-used programming language with powerful data analysis libraries such as Pandas, NumPy, and SciPy. It's suitable for data cleaning, transformation, statistical analysis, and machine learning.
* **R Language**: R is another programming language focused on statistical analysis, boasting a rich set of data manipulation, modeling, and visualization packages. It is particularly suited for complex statistical analysis and data exploration.
#### Data Visualization Tools
* **Tableau**: Tableau is a user-friendly business intelligence and data visualization tool that allows users to quickly create complex and interactive data visualizations.
* **Power BI**: Developed by Microsoft, Power BI is a robust data analysis and business intelligence platform that supports transforming data into easily understandable charts and reports.
* **Matplotlib and Seaborn**: These two Python libraries offer a wide range of chart and visualization types, suitable for creating static, animated, and interactive visualizations in the Python environment.
#### Development and Integration Tools
* **Jupyter Notebook**: Jupyter Notebook is an open-source web application that allows the creation and sharing of documents containing live code, equations, visualizations, and narrative text.
* **D3.js**: D3.js is a JavaScript library for creating complex data visualizations with web standards. It allows data-driven manipulations of the document and is a powerful tool for creating interactive web visualizations.
#### Usage Suggestions
* **Data Preprocessing**: Use Python or R for data cleaning and preprocessing before analysis and visualization to ensure data quality.
* **Choose the Right Tools**: Select the appropriate analysis and visualization tools based on your specific needs and technical background. For example, non-programming professionals might prefer Tableau or Power BI.
* **Learning and Community Resources**: Utilize online tutorials, courses, and community forums to learn best practices in data analysis and visualization.
* While AllTick does not directly provide data analysis and visualization tools, by combining its data with the above tools and techniques, users can effectively conduct data analysis and create in-depth market insights.
# How do I limit data usage to avoid exceeding subscription limits?
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues/how-do-i-limit-my-data-usage-to-avoid-exceeding-my-subscription-limits
This FAQ answers How do I limit data usage to avoid exceeding subscription limits?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Managing and limiting data usage is crucial to ensure you don't exceed the limits of your AllTick or any data service subscription. This not only helps avoid potential extra charges but also ensures the continued availability of the service. Here are some strategies and recommendations:
#### Understand Your Subscription Details
* Clearly understand the data usage limits included in your subscription plan, such as the number of API calls per month, data download volume, etc. This information can typically be found in the service agreement or the subscription management section of your user account.
#### Monitor Data Usage
* Utilize tools or APIs provided by AllTick to monitor your data usage. Regularly check to ensure that data usage stays within the subscription limits.
#### Optimize Data Requests
* Precisely request the data you need, avoiding unnecessary or duplicate requests. For example, if you only need data for a specific stock, do not request data for the entire market.
#### Implement Caching Strategies
* For data that is frequently requested, consider implementing a caching mechanism on your local or server. This way, the same data requests can first be served from the cache, reducing the number of requests to AllTick.
#### Adjust Data Update Frequency
* Adjust the frequency of data updates based on actual needs. If real-time data is not required, you can reduce the frequency of data requests, for example, from once every minute to once every hour or once a day.
#### Utilize Data Compression
* If supported by AllTick, requesting data in a compressed format can reduce the amount of data transmitted. For example, using gzip compression can significantly reduce the size of API responses.
#### Analyze and Forecast Data Needs
* Analyze your data usage patterns and predict future data needs. This can help you plan ahead and, if necessary, adjust your subscription plan in time to avoid exceeding limits.
#### Contact Customer Support
* If you're unsure how to effectively manage data usage or how to adjust your subscription to meet your needs, don't hesitate to contact AllTick's customer support team for assistance.
By taking these measures, you can more effectively manage your data usage, ensuring that you maximize the data services provided by AllTick without exceeding your subscription limits.
# How do I ensure the accuracy of data received from AllTick?
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues/how-to-ensure-the-accuracy-of-data-received-from-alltick
This FAQ answers How do I ensure the accuracy of data received from AllTick?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Ensuring the accuracy of data received from AllTick or any data provider is crucial, especially in the financial sector where data accuracy directly impacts the quality of decision-making. Here are some recommended practices to ensure data accuracy:
1. #### Verify Data Sources
Confirm that AllTick's data sources are reliable and authoritative. High-quality data providers will clearly state their data sources and ensure these sources are verified and trustworthy.
2. #### Data Comparison
Validate the data provided by AllTick using other reputable data sources. Comparing the same data points from multiple sources can help identify potential discrepancies or errors.
3. #### Check Data Integrity
Regularly check whether the received data is complete, especially in cases of large datasets or frequent updates. Ensure all expected data points have been received and there are no omissions.
4. #### Monitor Data Updates and Corrections
Financial data may be subject to subsequent updates or corrections. Pay attention to notifications from AllTick about data corrections and update your dataset in a timely manner to maintain accuracy.
5. #### Utilize Data Validation Tools
Use data validation tools or write custom scripts to automatically check the consistency and reasonableness of data. For example, verify if stock prices are within a reasonable range or if trading volumes match expected patterns.
6. #### Record and Track Data Quality Issues
Establish mechanisms to record any identified data quality issues and track their resolution. This can help identify patterns of data problems and assess the data provider's quality control processes.
7. #### Contact Technical Support
If you suspect there are issues with the data received, do not hesitate to contact AllTick's technical support team. Provide a detailed description of the issue and relevant data examples so they can effectively address the problem.
8. #### Education and Training
Ensure team members understand how to correctly handle and analyze data, including identifying potential anomalies or errors in the data. Regular training on data handling and analysis can improve the team's overall data literacy.
By taking these measures, you can significantly enhance the accuracy of the data received from AllTick, thus providing a solid foundation for data-driven decision-making. When handling any type of data, it's always important to maintain vigilance and critical thinking.
# How do I handle high-frequency updates of AllTick data?
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues/how-to-handle-high-frequency-updates-of-alltick-data
This FAQ answers How do I handle high-frequency updates of AllTick data?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
When handling high-frequency update data from AllTick or any financial data service provider, several strategies should be adopted to ensure the efficiency and accuracy of data processing. Here are some recommended practices:
1. #### Use Appropriate Data Processing Architecture
Consider using event-driven architecture or message queues (such as Kafka, RabbitMQ) to handle real-time data streams. These technologies can help you manage data flows effectively, ensure data is processed in order, and allow system components to scale independently.
2. #### Leverage Caching Technologies
For data that requires frequent access, using in-memory caches (like Redis, Memcached) can significantly improve access speed and system responsiveness.
3. #### Data Batch Processing
For data that does not require real-time processing, batch processing can be adopted. Accumulating data to a certain amount before processing it collectively can reduce the pressure on computation and storage.
4. #### Implement Rate Limiting and Backpressure Mechanisms
Implement rate limiting and backpressure mechanisms to prevent system overload during data peaks. These mechanisms can help you control the rate of data flow and ensure system stability.
5. #### Distributed System Design
Consider distributing data processing tasks across multiple systems or services, using load balancing techniques to disperse request pressure. Distributed system design can enhance data processing capabilities and system reliability.
6. #### Optimize Database Operations
Choose the appropriate database and optimize database operations. For high-frequency update data, databases that support high concurrency and rapid writing (such as NoSQL databases MongoDB, Cassandra, or time-series database InfluxDB) might be more suitable.
7. #### Monitoring and Alerts
Implement a monitoring system to track the performance and health status of the data processing workflow. Set up alert mechanisms to notify in a timely manner when processing delays, error rates, or system resource usage reach thresholds.
8. #### Flexible Data Update Strategies
Flexibly choose data update strategies based on application scenarios. For some scenarios, it may not be necessary to process every data update but instead accept approximations or snapshots at specific time points.
Handling high-frequency update data is a complex task that requires considering the importance of data, real-time requirements, and system resources among other factors. When designing and implementing data processing solutions, it is recommended to continuously evaluate and optimize to adapt to changing data volumes and business needs.
# How do I use AllTick WebSocket service?
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues/how-to-use-allticks-websocket-service
This FAQ answers How do I use AllTick WebSocket service?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Using AllTick's WebSocket service typically involves the following steps, aimed at providing developers with a stream of real-time financial data. Please note that specific implementation details may vary based on the API documentation provided by AllTick. Below is a general guidance process:
1. #### Understand the WebSocket Protocol
WebSocket is a network communication protocol that offers a full-duplex communication channel, allowing for real-time bidirectional data transmission between the client and the server. Understanding the basic workings of WebSocket can help you use AllTick's WebSocket service more effectively.
2. #### Consult AllTick's API Documentation
Visit AllTick's official documentation, especially the section about WebSocket services. The documentation should provide detailed guidance on how to establish a connection, request data, and handle data streams.
3. #### Obtain an API Key
To use AllTick's WebSocket service, you may need a valid API key. Typically, you can obtain the API key after registering and logging into your AllTick account, from the account management or API settings page.
4. #### Write Code to Establish a WebSocket Connection
Write code using your preferred programming language and WebSocket library to establish a connection to AllTick.
5. #### Send Data Requests
Once the WebSocket connection is established, you can send data requests as guided by AllTick's API documentation. The request format is usually JSON, depending on the type of data you wish to subscribe to.
6. #### Handle Received Data
In the WebSocket connection, you will receive server-pushed data in real-time. Write appropriate handling functions to process this data, such as updating real-time charts on a web page or executing trading strategies.
7. #### Manage the Connection
Manage the lifecycle of the WebSocket connection as needed. This includes closing the connection when data is no longer needed, as well as handling possible connection errors and reconnection logic.
8. #### Refer to Example Code and Libraries
Look at example code and recommended client libraries provided by AllTick, which can help you get started quickly and reduce development work.
9. When using the WebSocket service, ensure you comply with AllTick's terms of use, including restrictions on request frequency and data usage policies. If you encounter issues during use, refer to AllTick's FAQ or contact customer support for assistance.
# I encountered a technical problem when using the API. How can I solve it?
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues/i-encountered-a-technical-problem-when-using-the-api-how-can-i-solve-it
This FAQ answers I encountered a technical problem when using the API. How can I solve it?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
When encountering technical issues with API usage, you can seek solutions through the following steps:
1. #### Check the API Documentation
Start by thoroughly reading the API documentation provided by AllTick. Ensure your request adheres to the API specifications, including the correct endpoint address, request methods (GET, POST, etc.), required parameters, and parameter formats. The documentation might also include answers to frequently asked questions.
2. #### Review Error Codes and Messages
If the API response contains error codes or messages, these can often provide important clues about the cause of the issue. Look up the specific meanings and suggested solutions for these error codes in the API documentation.
3. #### Verify API Key and Permissions
Ensure the API key you are using is valid, and your account has the necessary permissions for the current operation. Expired API keys or incorrect permission settings can lead to request failures.
4. #### Check Network Connection
Confirm your device has normal access to the internet and that no network security settings (like firewall rules) are blocking communication with the API server.
5. #### Use Postman or Other API Testing Tools
Try sending requests using API testing tools like Postman. These tools can help you quickly test and debug API requests and more clearly view the details of requests and responses.
6. #### Search for Community and Forums
Search to see if other users have encountered similar issues. Developer communities, forums, or platforms like Stack Overflow may have relevant discussions and solutions.
7. #### Reduce Request Frequency
If encountering errors related to rate limiting, try reducing your request frequency. Many APIs have request rate limits to prevent overuse.
8. #### Write Minimal Test Cases
Create a request that is as simple as possible to exclude issues caused by complex data or logic. Once the simple case succeeds, gradually increase complexity to pinpoint the issue.
9. #### Contact Technical Support
If the above steps do not resolve the issue, contact AllTick's technical support for help. When contacting support, provide as detailed information as possible, including your request code, the complete error message, and the troubleshooting steps you have already attempted.
Solving technical issues often requires patience and meticulous debugging. By systematically checking and eliminating potential sources of the problem, most issues can eventually be resolved.
### Official Website
Official website: [https://alltick.co/](https://alltick.co/)
# What data formats does AllTick API support?
Source: https://alltick.co/apis/en/faqs/data-usage-and-technical-issues/what-data-formats-does-allticks-api-support
This FAQ answers What data formats does AllTick API support?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Common practices for financial market data API services like AllTick often support one or more of the following data formats:
#### JSON (JavaScript Object Notation)
JSON is one of the most common data exchange formats, widely used in Web APIs for its readability and writability, as well as its advantages in being easily parsed and generated by machines.
To precisely understand the data formats offered by AllTick and how to effectively use these data, it's essential to directly consult the official API documentation provided by AllTick. The documentation typically includes detailed information about supported data formats, data structures, how to make requests, and how to handle response data, among other key details.
If you cannot find the information you need in the documentation, or if you have any specific questions about using the API, directly contacting AllTick's customer support team is also an excellent option. They can provide the most accurate information and personalized assistance.
# Subscription and Account Management
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management
This FAQ answers Subscription and Account Management, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
# Can multiple people share one AllTick account?
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management/can-multiple-people-share-one-alltick-account
This FAQ answers Can multiple people share one AllTick account?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Typically, most online services and data providers, including financial market data services like AllTick, specify policies on account sharing in their terms of service. These policies are generally designed to protect the security of user data, ensure fair use of the service, and comply with licensing agreements.
Common account sharing policies include:
* Prohibition of Sharing:Explicitly prohibiting the sharing of account information, especially login credentials such as usernames and passwords. This is because sharing accounts can lead to data security risks, increase the possibility of unauthorized access, and may violate legal regulations on data use and access.
* Specific Permissions:Some services may allow account sharing under specific conditions, such as corporate or team subscriptions that include multi-user access as part of the package. These types of subscriptions usually provide an administration system that allows the main account holder to manage access rights for sub-accounts.
#### How to Address Account Sharing with AllTick**:**
* **Review the Terms of Service**: First, carefully read AllTick's terms of service or user agreement to understand the specific provisions regarding account sharing.
* **Consider Team or Enterprise Solutions**: If AllTick offers team or enterprise-level subscription plans, these plans may be designed to support multi-user access and provide a legal way to share accounts.
* **Contact Customer Support**: If the terms of service do not explicitly address this issue, or if you have questions about the regulations, directly contact AllTick's customer support for more information and guidance.
* **Comply with Regulations**: To protect your data security and avoid potential legal risks, it is important to strictly adhere to AllTick's account usage regulations.
In summary, if you're considering sharing an AllTick account, it's crucial to first understand and comply with the relevant provisions in its terms of service. In many cases, compliant multi-user access solutions, such as enterprise or team subscriptions, can meet the needs of multiple users while ensuring security and legality.
# Can my subscription be refunded?
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management/can-my-subscription-be-refunded
This FAQ answers Can my subscription be refunded?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Typically, subscriptions to AllTick and similar financial data service platforms are non-refundable. This means once you've purchased a subscription service, whether it's a monthly or annual plan, you're generally not eligible for a refund of the fees paid. This policy helps service providers manage and maintain high-quality data streams and service stability.
#### Why Subscriptions Are Usually Non-refundable:
1. **Immediate Access to High-Value Data**: Subscription services often provide immediate access to valuable market data and analytical tools. Once users gain access, they can immediately consume this content.
2. **Service Costs**: Delivering real-time or historical financial data involves significant infrastructure and operational costs. These costs are supported by subscription fees, so refunds could impact the provider's ability to maintain and update these services.
3. **Preventing Abuse**: A no-refund policy helps prevent users from consuming a large amount of data in a short period and then requesting a refund, which, if allowed, could impose an unfair burden on the service provider.
#### Considerations Before Purchasing:
* **Assess Your Needs**: Before subscribing, carefully assess your data needs and budget to ensure the chosen plan meets your business or research requirements.
* **Utilize Trial Periods**: If AllTick offers a free trial period, take full advantage of this opportunity to assess whether the service meets your needs.
* **Read the Terms of Service**: Before purchasing a subscription, make sure to thoroughly read the terms of service, understanding the specific provisions regarding the refund policy.
If you have any questions about your subscription plan or services, including detailed information about the refund policy, it's recommended to directly contact AllTick's customer support for the most accurate guidance and assistance. This way, you can make an informed decision based on a full understanding of the terms and conditions.
# Does AllTick offer a free trial period?
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management/does-alltick-offer-a-free-trial-period
This FAQ answers Does AllTick offer a free trial period?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Yes, after registering with AllTick, users will receive a one-week free trial period. During this week, you can access AllTick's financial market data APIs, including real-time and historical data services, for free. This free trial period offers you the opportunity to fully evaluate AllTick's services, including the accuracy of the data, the response speed of the API, and the overall user experience.
If you find AllTick's services particularly useful for your project or research during the free trial period, but you wish to have more time to evaluate its services, you can contact AllTick's customer service team to request an extension of the trial period. The possibility of extending the trial depends on AllTick's specific policies and your usage situation. When requesting an extension of the trial period, providing your usage plan and why you need more time to evaluate the services may be helpful.
Please note that the specific terms and conditions of the free trial period, including any restrictions on data access, should be clearly stated on AllTick's official website or service agreement. Make sure to understand these details before starting to use the service to avoid any surprises when the trial period ends.
# How do I cancel AllTick subscription service?
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management/how-to-cancel-allticks-subscription-service
This FAQ answers How do I cancel AllTick subscription service?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
AllTick's subscription service is non-cancellable during the service period, meaning once you've subscribed to AllTick's services, you will be able to enjoy its data services throughout the entire subscription period but will not be able to cancel the service and receive a refund during this time. This policy ensures that users fully consider and evaluate their needs before subscribing while also guaranteeing that AllTick can continue to provide high-quality data services.
As your subscription approaches the renewal date, AllTick offers flexible renewal options. You have the autonomy to decide whether to continue renewing the service, and AllTick will not automatically charge your credit card. This approach prevents unintended renewals and reflects AllTick's commitment to honest service to its users.
If you decide not to renew, it's recommended to complete the non-renewal process before the current subscription period ends, following the guidelines provided by AllTick. This may involve logging into your account to change subscription settings or directly notifying AllTick's customer service.
In summary, AllTick's subscription and renewal policies are designed to provide users with flexibility and control while ensuring transparency and integrity in the service. If you have any questions or need assistance, contacting AllTick's customer support team directly is the best course of action.
# How do I change my account information?
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management/how-to-change-my-account-information
This FAQ answers How do I change my account information?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Changing your AllTick account information typically involves the following steps. Please note that specific steps may vary due to the design and functionality updates of the AllTick website. Here is a general guidance process:
1. #### Log In to Your Account
First, visit the AllTick official website and log into your account using your username and password.
2. #### Access Account Settings
After logging in, find the "Account Settings," "Profile," or a similar section within the website's user interface. This is usually located in the top navigation bar or the account overview page.
3. On the Account Settings or Profile page, look for an "Edit," "Change," or similar option to modify your account information. The information you might be able to change includes:
* Email address
* Username (if applicable)
* Password (and confirm password)
* Any necessary contact information
4. #### Save Changes
After making the necessary changes, ensure you click "Save," "Update," or a similar button to save your changes. Some changes (such as email address or password) may require additional verification steps, such as entering the current password or clicking on a verification link.
5. #### Verify Changes (If Necessary)
If you changed your email address, you might need to receive and click on a verification link from the new email address to confirm the change was initiated by you.
6. #### Confirm Changes Were Successful
After completing and saving the changes, you might receive a notification confirming that your account information has been updated. Check to ensure all changes have been made as intended.
7. #### Contact Customer Support (If Needed)
If you encounter any issues while attempting to change your account information, or if some information cannot be changed via the website interface, it's recommended to directly contact AllTick's customer support team for assistance.
When changing account information, ensure the information you provide is accurate and up-to-date, especially contact information and email addresses, as these are often used for account security and urgent notifications.
# How do I register an AllTick account?
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management/how-to-register-an-alltick-account
This FAQ answers How do I register an AllTick account?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Registering for an AllTick account typically involves the following steps, aimed at providing users access to its financial market data API. Note that the specific registration process may vary over time or differ based on website updates. Here is a basic guidance process:
1. #### Visit the Official Website
Open a browser and visit AllTick's official website:[https://alltick.co](https://alltick.co/)
2. #### Find the Registration/Create Account Option
On the website's homepage, look for a "Register," "Create Account," or similar button. This is usually located in the top navigation bar or in a prominent position on the homepage.
3. #### Fill Out the Registration Form
* After clicking the registration button, you will be directed to a registration form page. On this page, fill in the required information as instructed, including but not limited to:
* Email address
* Username (if applicable)
* Password (and confirm the password)
* Any necessary contact information
* In some cases, you may also be asked to enter a captcha to verify that you are not a robot.
4. #### Read and Agree to the Terms of Service
Before submitting your registration information, make sure to read AllTick's terms of service, privacy policy, and any related agreements. If you agree to these terms, check the appropriate checkbox.
5. #### Submit Registration Information
After completing the form and agreeing to the terms of service, click "Submit," "Register," or a similar button to complete the registration process.
6. #### Email Verification (If Required)
In some cases, AllTick may send a verification email to the email address you provided. Open the email and click the verification link to activate your account.
7. #### Log In and Start Using
Once your account is registered and activated, you can log in to AllTick using the email address and password set during registration and start using the services provided.
If you encounter any issues during the registration process, it's recommended to check AllTick's help center or contact their customer support for assistance. Remember, keeping your account information secure is very important; do not share your login credentials with others.
# How do I secure my AllTick account?
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management/how-to-secure-my-alltick-account
This FAQ answers How do I secure my AllTick account?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Ensuring the security of your AllTick account is crucial. Here are some recommended best practices:
1. #### Use a Strong Password
Create a complex password that includes at least 8 characters, combining upper and lower case letters, numbers, and special symbols. Avoid using easily guessable passwords, such as "password," "123456," or other common combinations.
2. #### Regularly Update Your Password
Change your password regularly, especially if you've used the same password on other websites that have experienced security breaches.
3. #### Secure Your Email Account
Your email account is key to recovering your AllTick account password. Ensure your email account also uses a strong password and two-factor authentication.
4. #### Beware of Phishing Attacks
Be cautious of any suspicious emails or messages that appear to be from AllTick, asking you to log in or provide personal information. Ensure you only enter your login details on AllTick's official website.
5. #### Use Secure Network Connections
Avoid accessing your AllTick account over public Wi-Fi or untrusted networks. Consider using a Virtual Private Network (VPN) if you need to connect in public places.
6. #### Keep Your Software Updated
Ensure your operating system, browser, and any security software are up to date. Software updates often include security patches that can protect you from attacks exploiting known vulnerabilities.
7. #### Monitor Account Activity
Regularly check your AllTick account activity for any unusual login attempts or unauthorized actions. If you notice suspicious activity, change your password immediately and notify AllTick customer support.
8. #### Access Your Account from Secure Devices
Make sure the devices you use to access your AllTick account are free from viruses or malware. Run regular security scans and install reliable security software.
By following these security best practices, you can significantly reduce the risk of unauthorized access to your account, protecting your financial data and personal information.
# How do I upgrade my AllTick subscription plan?
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management/how-to-upgrade-my-alltick-subscription-plan
This FAQ answers How do I upgrade my AllTick subscription plan?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
Upgrading your AllTick subscription plan usually involves the following steps. Note that specific steps may vary based on the design and functionality updates of the AllTick website. Here is a general guidance process:
1. #### Log In to Your Account
First, visit the AllTick official website and log into your account. You will need to enter your username and password.
2. #### Access Account Settings or Subscription Management
After logging in, find the "Account Settings," "Subscription Management," or a similar section within the website's user interface. This is usually located in the top navigation bar or the account overview page.
3. #### Find the Upgrade Option
In the Account Settings or Subscription Management page, look for an "Upgrade Plan," "Change Plan," or similar option. This will allow you to view different subscription plans along with their included services and prices.
4. #### Select a New Subscription Plan
Browse through the different subscription plans and choose a new plan that suits your needs. Consider factors such as data access rights, API request limits, and pricing for each plan.
5. #### Confirm Upgrade Details
After selecting a new subscription plan, carefully read the terms and conditions of the upgrade. This may include a new billing cycle, fees, and any possible changes to the services.
6. #### Complete Payment (If Required)
If the new subscription plan requires additional payment, complete the payment process as instructed. This may involve entering payment information and confirming the transaction.
7. #### Confirm the Upgrade Success
After completing the upgrade process, ensure you receive a confirmation of the upgrade, possibly through email or a message on the website. Check your account details to confirm that the new subscription plan has taken effect.
8. #### Contact Customer Support (If Needed)
If you encounter any issues during the upgrade process, or if you need more information about different plans, directly contact AllTick's customer support team.
9. Remember, it's important to understand the specific offerings and costs of the new plan before upgrading your subscription, to ensure it meets your needs and fits your budget. If the AllTick website offers an option to trial the new plan, this can also be a good way to get to know the new services and evaluate whether it's worth the upgrade.
# I forgot my login password. What should I do?
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management/i-forgot-my-login-password-what-should-i-do
This FAQ answers I forgot my login password. What should I do?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
If you've forgotten your AllTick account password, it can typically be reset through the following steps:
1. #### Visit the Login Page
First, visit the AllTick official website and navigate to the login page.
2. #### Find the "Forgot Password" Link
Near the login form, there should be a "Forgot Password?" or similar link. Click this link to start the password reset process.
3. #### Enter Your Email Address
Follow the instructions and enter the email address you used to register your AllTick account. Ensure you enter the correct email address, as the instructions for resetting your password will be sent to this address.
4. #### Check Your Email
After submitting your email address, AllTick will send an email containing password reset instructions to that address. This may take a few minutes, so please be patient and check your spam folder in case the email is mistakenly marked as spam.
5. #### Follow the Instructions in the Email to Reset Your Password
Open the email sent by AllTick and click the link within the email or follow the given instructions. This will typically lead you to a page where you can set a new password.
6. #### Set a New Password
On the specified page, enter your new password. You may be required to enter the new password twice to confirm it is correct.
7. #### Complete the Password Reset and Log In
After setting the new password, you should be able to log in to your AllTick account using the new password. Make sure to remember this new password or use a password manager to save it.
8. #### Contact Customer Support
If you encounter any problems during the password reset process or do not receive the password reset email, please contact AllTick's customer support directly for assistance.
When resetting your password, it's important to choose a password that is both secure and easy to remember. It is recommended to use a combination of upper and lower case letters, numbers, and special characters to enhance the security of your account.
# What services does my subscription include?
Source: https://alltick.co/apis/en/faqs/subscription-and-account-management/what-services-does-my-subscription-include
This FAQ answers What services does my subscription include?, covering common questions about AllTick API usage, subscriptions, account management, data quality and technical integration.
AllTick primarily offers real-time and historical financial market data API services, including forex, stocks, commodities, and cryptocurrencies. These services are designed to provide developers, fintech companies, traders, institutions, and research organizations with reliable data sources to support them in building innovative trading and analysis tools.
#### Services Provided Include:
* **Forex API**: Offers real-time updates for over 1,000 currency pairs from the world's leading banking institutions.
* **Commodities API**: Provides real-time and historical data for all major precious metals (such as gold and silver) and energy categories.
* **Stock API**: Covers real-time and historical data for 170,000+ stocks in the United States and Hong Kong.
* **Cryptocurrency API**: Offers real-time and historical data from all major cryptocurrency exchanges, unified in one easy-to-use API.
AllTick emphasizes the accuracy, speed, reliability, and broad coverage of its system, boasting a 99.95% Service Level Agreement (SLA) and providing ultra-low latency real-time data streams through technologies like WebSocket, ensuring users receive accurate and timely market information.
AllTick aims to meet the diverse needs of users ranging from individual traders to large institutions. The specific services included in a subscription, such as request limits, data refresh rates, and historical data access, may depend on the chosen subscription plan.
# Error Code Description
Source: https://alltick.co/apis/en/getting-started/error-code-description
This page lists error codes for AllTick HTTP and WebSocket market data APIs, explaining the meaning, common causes, and troubleshooting suggestions for each code, so developers can quickly diagnose authentication failures, rate limit hits, parameter issues, and other problems when integrating realtime or historical forex, stock, and crypto data.
| Error Code | Error Content | Meaning |
| - | - | - |
| 200 | ok | Success |
| 400 | request header param invalid | The first-level parameters of the request JSON are invalid.
Troubleshooting suggestions:
1. Check whether the JSON structure is complete.
2. Confirm that all required fields are included correctly.
3. Verify that the data field is a valid object.
4. Check whether key fields such as trace exist. |
| 400 | request data param invalid | The data field parameters in the request JSON are invalid.
Troubleshooting suggestions:
1. Check whether the data field is a valid object.
2. Confirm that all required fields in data are filled in correctly.
3. Compare the data field content with the specific interface documentation.
4. For POST requests, pay special attention to whether the JSON parameters in the body are complete and correct. |
| 401 | token invalid | The token is invalid.
Possible causes:
1. The Token format is incorrect.
2. The Token account has expired. |
| 402 | query invalid | The query parameter of the request is invalid.
Troubleshooting suggestions:
1. Check the query parameter of the GET request.
2. URL-encode the query parameter.
3. Ensure that the parameter format meets the interface requirements.
4. Verify that special characters are escaped correctly. |
| 429 | Too Many Requests | The request frequency exceeds the limit specified by the plan.
Suggestions:
1. Optimize the request frequency and logic.
2. Consider upgrading the plan to obtain a higher request frequency.
Interface restriction pages:
HTTP Interface Restrictions
WebSocket Interface Restrictions
Common scenario:
For the Basic plan, if `/kline` is requested at least twice within one second, the first request succeeds and the second request returns 429 Too Many Requests, because the Basic plan allows only one `/kline` request per second. |
| 600 | code invalid | The requested product code is invalid.
Troubleshooting suggestions:
1. Check the request URL. Stock data and forex/precious-metals data use different request URLs.
2. Check the product code. Compare it with the product list and make sure it is valid and accurate: Product List |
| 601 | body empty | The request body data is empty.
Troubleshooting suggestions:
1. Check the body of the POST request.
2. Ensure that the body contains complete JSON parameters.
3. Pay special attention to batch interfaces such as `/batch-kline`.
4. Verify that all required fields are filled in correctly. |
| 603 | token level not enough | The number of requested products or K-lines exceeds the limit specified in the interface documentation.
Troubleshooting suggestions:
1. Check the number of products. For K-line interfaces, confirm whether the total of product count and K-line type count exceeds the plan limit. For non-K-line interfaces, confirm whether the requested product count exceeds the plan limit.
2. Verify the K-line request. Confirm that the number of K-lines complies with the interface rules. The batch product K-line interface allows only 2 K-lines per request.
Interface restriction page: HTTP Interface Restrictions |
| 604 | code unauthorized | Your token does not have permission to request this code. |
| 605 | too many requests | Request frequency limit.
Suggestions:
1. Optimize the request frequency and logic.
2. Consider upgrading the plan to obtain a higher request frequency.
Interface restriction pages:
HTTP Interface Restrictions
WebSocket Interface Restrictions |
| 606 | too many requests and connection will be closed | Usually caused by WebSocket interface request frequency limits.
Troubleshooting suggestions:
1. Check the number of WebSocket connections and confirm whether it exceeds the maximum number allowed by the plan.
2. Control the request frequency and ensure that multiple WebSocket requests are at least 3 seconds apart.
Interface restriction page: WebSocket Interface Restrictions |
***
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# HTTP Interface Restrictions
Source: https://alltick.co/apis/en/getting-started/http-interface-restrictions
This page explains HTTP Interface Restrictions, covering AllTick API integration flow, token setup, standard headers, endpoint addresses, rate limits and error codes.
### 1. Frequency Limits
| Plan | Individual Request | Multiple HTTP Interfaces Requested Together |
| - | - | - |
| Free | **/kline:** one request every 10 seconds
**/batch-kline:** one request every 10 seconds
**/depth-tick:** one request every 10 seconds
**/trade-tick:** one request every 10 seconds
**/static\_info:** one request every 10 seconds
**/api/suspension/sse:** one request every 1 minute
**/api/suspension/nyse:** one request every 1 minute
**/api/suspension/nasdaq:** one request every 1 minute | 1. Only one interface can be requested every 10 seconds.
2. Note that /batch-kline requires a 10-second interval.
3. All interfaces combined: maximum 10 requests per minute (one every 6 seconds).
4. Maximum 1,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Basic | **/kline:** one request per second
**/batch-kline:** one request every 3 seconds
**/depth-tick:** one request per second
**/trade-tick:** one request per second
**/static\_info:** one request per second
**/api/suspension/sse:** one request every 1 minute
**/api/suspension/nyse:** one request every 1 minute
**/api/suspension/nasdaq:** one request every 1 minute | 1. Only one interface can be requested in the same second.
2. Note that /batch-kline requires a 3-second interval.
3. All interfaces combined: maximum 60 requests per minute (one per second).
4. Maximum 86,400 requests per day; usage resumes after midnight the next day if exceeded. |
| Premium | **/kline:** up to 10 requests per second
**/batch-kline:** one request every 2 seconds
**/depth-tick:** up to 10 requests per second
**/trade-tick:** up to 10 requests per second
**/static\_info:** up to 10 requests per second
**/api/suspension/sse:** one request every 1 minute
**/api/suspension/nyse:** one request every 1 minute
**/api/suspension/nasdaq:** one request every 1 minute | 1. All interfaces combined: up to 10 requests per second.
2. Note that /batch-kline requires a 2-second interval.
3. All interfaces combined: maximum 600 requests per minute (10 per second).
4. Maximum 864,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Professional | **/kline:** up to 20 requests per second
**/batch-kline:** one request per second
**/depth-tick:** up to 20 requests per second
**/trade-tick:** up to 20 requests per second
**/static\_info:** up to 20 requests per second
**/api/suspension/sse:** one request every 1 minute
**/api/suspension/nyse:** one request every 1 minute
**/api/suspension/nasdaq:** one request every 1 minute | 1. All interfaces combined: up to 20 requests per second.
2. Note that /batch-kline requires a 1-second interval.
3. All interfaces combined: maximum 1,200 requests per minute (20 per second).
4. Maximum 1,728,000 requests per day; usage resumes after midnight the next day if exceeded. |
| All Hong Kong Stocks | Same as Professional | Same as Professional |
| All A Shares | Same as Professional | Same as Professional |
| All US Stocks | Same as Professional | Same as Professional |
### 2. IP Limits
* HTTP interfaces limit request frequency only by Token and do not restrict IP addresses.
* **Example**: the Basic plan allows one request per second. If a Token requests `/kline` once at 14:03:01 and calls `/trade-tick` once in the same minute, the backend service will respond normally. If the same Token sends two `/kline` requests within 14:03:01, the first request will be served normally and the second request will receive an error response.
### 3. K-line Query Limits
* **/kline:** each query request can request K-line data for only one product code. Each query returns at most 500 K-lines. If more than 500 K-lines are requested, the system queries and returns 500.
* **/batch-kline:** each query request can request K-line data for multiple product codes. The number of code/type groups allowed per batch varies by plan. Each query returns at most 2 K-lines. If more than 2 K-lines are requested, the system queries and returns 2.
| Plan | Maximum code/type groups for /batch-kline |
| - | - |
| Free | Up to 5 groups per request. One group = one product + one K-line type. For example, requesting BTCUSDT 1-minute and 5-minute K-lines counts as 2 groups. |
| Basic | Up to 100 groups per request. |
| Premium | Up to 200 groups per request. |
| Professional | Up to 500 groups per request. |
| All Hong Kong Stocks | Up to 500 groups per request. |
| All A Shares | Up to 500 groups per request. |
| All US Stocks | Up to 500 groups per request. |
### 4. Latest Trade Price Query Limits
* **/trade-tick:** each query request can request the latest trade price for multiple product codes. The number of codes allowed per batch varies by plan.
* If the request exceeds the number of codes allowed by the plan, the system only queries and returns results for the first codes within the allowed number.
| Plan | Maximum codes per request |
| - | - |
| Free | Up to 5 codes per request. |
| Basic | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/trade-subscription) |
| Premium | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/trade-subscription) |
| Professional | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/trade-subscription) |
| All Hong Kong Stocks | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/trade-subscription) |
| All A Shares | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/trade-subscription) |
| All US Stocks | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/trade-subscription) |
### 5. Order Book Query Limits
* **/depth-tick:** each query request can request order book data for multiple product codes. The number of codes allowed per batch varies by plan.
* If the request exceeds the number of codes allowed by the plan, the system only queries and returns results for the first codes within the allowed number.
| Plan | Maximum codes per request |
| - | - |
| Free | Up to 5 codes per request. |
| Basic | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/depth-subscription) |
| Premium | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/depth-subscription) |
| Professional | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/depth-subscription) |
| All Hong Kong Stocks | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/depth-subscription) |
| All A Shares | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/depth-subscription) |
| All US Stocks | Due to GET URL length limits, a maximum of 50 codes per request is recommended. For more batch subscriptions, use the WebSocket interface: [Interface](/apis/en/websocket/depth-subscription) |
### 6. Static Information Query Limits
* **/static\_info:** each query request can request static information for multiple product codes. The number of codes allowed per batch varies by plan.
* If the request exceeds the number of codes allowed by the plan, the system only queries and returns results for the first codes within the allowed number.
| Plan | Maximum codes per request |
| - | - |
| Free | Up to 5 codes per request. |
| Basic | Due to GET URL length limits, a maximum of 50 codes per request is recommended. |
| Premium | Due to GET URL length limits, a maximum of 50 codes per request is recommended. |
| Professional | Due to GET URL length limits, a maximum of 50 codes per request is recommended. |
| All Hong Kong Stocks | Due to GET URL length limits, a maximum of 50 codes per request is recommended. |
| All A Shares | Due to GET URL length limits, a maximum of 50 codes per request is recommended. |
| All US Stocks | Due to GET URL length limits, a maximum of 50 codes per request is recommended. |
#### Notes
* Plan your request strategy according to these limits to avoid unnecessary service interruptions.
* These limits ensure fair service access for all users and protect backend systems from excessive load.
* If you have questions or need further help, contact customer support.
# WebSocket Interface Restrictions
Source: https://alltick.co/apis/en/getting-started/websocket-interface-limitations
This page explains WebSocket Interface Restrictions, covering AllTick API integration flow, token setup, standard headers, endpoint addresses, rate limits and error codes.
## 1. IP Limits
#### 1.1 The number of WebSocket connections is limited by the number allowed for the Token, not by IP address.
* Example: the Basic plan allows only one WebSocket connection per Token. If IP address A has already started one WebSocket connection, a second WebSocket connection using the same IP address A will be rejected, and a second WebSocket connection using IP address B will also be rejected. Both are rejected because the Basic plan allows only one WebSocket connection.
* Example: the Premium plan allows three WebSocket connections per Token. You may start three WebSocket connections from IP address A, or start one connection each from IP addresses A, B, and C, as long as the total number of connections does not exceed three.
#### 1.2 Stock/index data and forex/precious-metals/crude-oil data use different request URLs. Connecting to both data categories at the same time is counted as one WebSocket connection, and both categories can be requested simultaneously.
* Example: the Basic plan allows only one WebSocket connection per Token. If IP address A has already started one WebSocket connection for stock data, you can still start one WebSocket connection for forex/precious-metals data from IP address A or IP address B.
## 2. Interface Call Frequency Limits
#### 2.1 Frequency limits for each interface
* Latest trade price (tick-by-tick) interface: one request per second.
* Order Book interface: one request per second.
#### 2.2 When requesting multiple interfaces in the same WebSocket connection, the interval between requests must be at least 1 second.
* Example: if user A sends a WebSocket request for the latest trade price interface (request protocol number 22004) at 28:30 and tries to send another latest order book request (request protocol number 22002) in the same second, the second request will be rejected by the system.
#### 2.3 When starting multiple WebSocket requests across multiple WebSocket connections, each WebSocket request must be spaced at least 3 seconds apart.
* Example: user A has purchased the Premium plan, which supports three simultaneous WebSocket connections. If user A starts the first WebSocket connection at 28:30, they should wait 3 seconds and start the second subscription at 28:34. After both subscriptions succeed, keep sending a heartbeat every 10 seconds and the interface will push data in real time.
#### 2.4 When the connection is disconnected and repeated reconnection is needed:
* Free plan users: at least 10 seconds between two reconnection attempts.
* Paid users, including Basic, Premium, Professional, All Hong Kong Stocks, All A Shares, and All US Stocks: at least 3 seconds between two reconnection attempts.
## 3. Connection Count Limits
* Different plans have different connection count limits, as shown below.
* If a connection attempt exceeds the specified limit, the excess connection attempt will be disconnected directly.
| Plan | WebSocket Connections |
| - | - |
| Free | Only 1 WebSocket connection |
| Basic | Only 1 WebSocket connection |
| Premium | Up to 3 WebSocket connections |
| Professional | Up to 10 WebSocket connections |
| All Hong Kong Stocks | Up to 10 WebSocket connections |
| All A Shares | Up to 10 WebSocket connections |
| All US Stocks | Up to 10 WebSocket connections |
## 4. Product Code Subscription Limits
* A single WebSocket connection can subscribe to only a limited number of product codes at one time.
* If the subscription request exceeds the specified limit, the system will only process the first requests within the limit and ignore the rest.
| Plan | Code Subscription Limit |
| - | - |
| Free | **Latest trade price (tick-by-tick):** up to 5 products at the same time
**Order Book:** up to 5 products at the same time |
| Basic | **Latest trade price (tick-by-tick):** up to 100 products at the same time
**Order Book:** up to 100 products at the same time |
| Premium | **Latest trade price (tick-by-tick):** up to 200 products at the same time
**Order Book:** up to 200 products at the same time |
| Professional | **Latest trade price (tick-by-tick):** up to 3000 products at the same time
**Order Book:** up to 3000 products at the same time |
| All Hong Kong Stocks | **Latest trade price (tick-by-tick):** up to 3000 products at the same time
**Order Book:** up to 3000 products at the same time |
| All A Shares | **Latest trade price (tick-by-tick):** up to 3000 products at the same time
**Order Book:** up to 3000 products at the same time |
| All US Stocks | **Latest trade price (tick-by-tick):** up to 3000 products at the same time
**Order Book:** up to 3000 products at the same time |
#### Notes
* Plan your WebSocket connections and request strategy according to these limits to avoid unnecessary service interruptions.
* These limits ensure fair and efficient access for all users and protect backend services from improper load.
* If you encounter any problem or need further help, contact the technical support team.
# Welcome
Source: https://alltick.co/apis/en/index
AllTick API documentation covers real-time stock, forex, crypto, precious metals, oil and index market data APIs with HTTP REST endpoints and low-latency WebSocket streaming.
### What is AllTick
AllTick ([https://alltick.co/](https://alltick.co/)) provides a complete financial market Tick data solution, covering market data interfaces for forex, Hong Kong stocks, US stocks, commodities, cryptocurrencies, and more. It is designed for exchanges, developers, quantitative teams, fintech companies, and professional institutions.
### Main Features
* **Comprehensive coverage**: Provides real-time and historical data support for global financial markets, including forex, stocks, Hong Kong stocks, US stocks, commodities, and cryptocurrencies.
* **Multi-language client libraries**: Supports client libraries for multiple programming languages, making it easier for developers to integrate and use quickly.
* **WebSocket and REST API access**: Provides WebSocket and REST API access methods to ensure low-latency and highly reliable data.
* **High reliability**: Reliable data sources and stable services ensure data accuracy and completeness.
* **Customized services**: Provides customized services and solutions for professional institutions and fintech companies to meet different customer needs.
### Target Users
* Developers: Developers who want to build trading analysis tools and market trend analysis tools.
* Quantitative teams: Quantitative teams dedicated to developing quantitative trading strategies and algorithms.
* Fintech companies: Companies that provide fintech solutions and services.
* Professional institutions: Professional institutions that need accurate and timely financial market data support.
### Use Cases
* Build trading analysis tools: Use the provided data support to build trading analysis tools for market trend analysis and forecasting.
* Develop quantitative trading strategies: Develop and optimize quantitative trading strategies and algorithms based on real-time and historical data.
* Provide fintech services: As a fintech company, provide financial data services and solutions, and deliver customized fintech products to customers.
* Provide data support for professional institutions: Provide real-time and historical data support for professional institutions to help them conduct market research and make decisions.
### Product Categories
* Forex: Real-time forex data APIs, real-time forex quote APIs, forex historical K-line data, daily K-line data, monthly K-line data, hourly K-line data, minute K-line data, forex tick data, and other market financial data (representative products: USDJPY, EURUSD, and other market financial data)
* Stocks: Real-time stock data APIs, real-time Hong Kong stock quote APIs, real-time US stock quote APIs, stock historical K-line data, daily K-line data, monthly K-line data, hourly K-line data, minute K-line data, and stock tick data (representative products: Apple, Tesla, and other market financial data)
* Precious Metals: Real-time precious metals data APIs, real-time precious metals quote APIs, precious metals historical K-line data, gold historical K-line data, daily K-line data, monthly K-line data, hourly K-line data, minute K-line data, and precious metals/gold tick data (representative products: GOLD, USOIL, Silver, and other market financial data)
* Cryptocurrencies: Real-time cryptocurrency data APIs, real-time cryptocurrency quote APIs, cryptocurrency historical K-line data, daily K-line data, monthly K-line data, hourly K-line data, minute K-line data, and cryptocurrency tick data (representative products: BTCUSDT, ETHUSDT, and other market financial data)
* Global Indices: Global stock index data APIs, index historical K-lines, daily K-line data, monthly K-line data, hourly K-line data, minute K-line data, and stock tick data (representative products: Dow Jones Industrial Average, S\&P 500, and other market financial data)
***
### Official Website
Official website: [https://alltick.co/](https://alltick.co/)
# HTTP Common Standard Header
Source: https://alltick.co/apis/en/integration-process/http-common-standard-headers
This page details the common standard HTTP headers required by AllTick REST market data APIs, including token, Content-Type, Accept, and other mandatory or optional fields, with examples to help developers build valid HTTP request headers for authenticated access to forex, stock, and crypto tick data.
## Common Request Header Description
| Field | Name | Type | Required | Description |
| - | - | - | - | - |
| trace | Trace ID | string | Yes | Generated uniquely by the requester. The response keeps the same value as the request. Maximum length: 64. |
| data | Data body | object | Yes | See each interface definition for the specific data format. |
```json theme={null}
{
"trace": "c2a8a146-a647-4d6f-ac07-8c4805bf0b74",
"data": {}
}
```
## Common Response Header Description
| Field | Name | Type | Description |
| - | - | - | - |
| ret | Return value | int32 | [Error Code Description](/apis/en/getting-started/error-code-description) |
| msg | Message | string | Specific description of success or failure. |
| trace | Trace ID | string | Generated uniquely by the requester. The response keeps the same value as the request. Maximum length: 64. |
| data | Data body | object | See each interface definition for the specific data format. |
```json theme={null}
{
"ret": 202,
"msg": "request data param invalid",
"trace": "c2a8a146-a647-4d6f-ac07-8c4805bf0b74",
"data": {}
}
```
***
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# HTTP Quotes API Address Description
Source: https://alltick.co/apis/en/integration-process/http-quotes-api-address-description
This page explains HTTP Quotes API Address Description, covering AllTick API integration flow, token setup, standard headers, endpoint addresses, rate limits and error codes.
## API Address Description
### Stock HTTP Interface API Address
`/quote-stock-b-api` Stock query API
The query API uses the HTTPS protocol. The full URL is:
[https://quote.alltick.co/quote-stock-b-api](https://quote.alltick.co/quote-stock-b-api)
Each time you send a query request, you need to include the method name and token information.
Single-product K-line request example:
[https://quote.alltick.co/quote-stock-b-api/kline?token=your\_token\&query=queryData](https://quote.alltick.co/quote-stock-b-api/kline?token=your_token\&query=queryData)
Batch product K-line request example:
[https://quote.alltick.co/quote-stock-b-api/batch-kline?token=your\_token](https://quote.alltick.co/quote-stock-b-api/batch-kline?token=your_token)
Note: When requesting K-lines for products in batches, the request parameters are placed in the body.
Latest trade price request example:
[https://quote.alltick.co/quote-stock-b-api/trade-tick?token=your\_token\&query=queryData](https://quote.alltick.co/quote-stock-b-api/trade-tick?token=your_token\&query=queryData)
Latest order book request example:
[https://quote.alltick.co/quote-stock-b-api/depth-tick?token=your\_token\&query=queryData](https://quote.alltick.co/quote-stock-b-api/depth-tick?token=your_token\&query=queryData)
For the specific calling method, please see the HTTP interface list.
### Forex, Cryptocurrencies (Digital Coins), and Commodities (Precious Metals) HTTP Interface API Address
`/quote-b-api` Forex, cryptocurrencies (digital coins), and commodities (precious metals) query API
The query API uses the HTTPS protocol. The full URL is:
[https://quote.alltick.co/quote-b-api](https://quote.alltick.co/quote-b-api)
Each time you send a query request, you need to include the method name and token information.
Single-product K-line request example:
[https://quote.alltick.co/quote-b-api/kline?token=your\_token\&query=queryData](https://quote.alltick.co/quote-b-api/kline?token=your_token\&query=queryData)
Batch product K-line request example:
[https://quote.alltick.co/quote-b-api/batch-kline?token=your\_token](https://quote.alltick.co/quote-b-api/batch-kline?token=your_token)
Note: When requesting K-lines for products in batches, the request parameters are placed in the body.
Latest trade price request example:
[https://quote.alltick.co/quote-b-api/trade-tick?token=your\_token\&query=queryData](https://quote.alltick.co/quote-b-api/trade-tick?token=your_token\&query=queryData)
Latest order book request example:
[https://quote.alltick.co/quote-b-api/depth-tick?token=your\_token\&query=queryData](https://quote.alltick.co/quote-b-api/depth-tick?token=your_token\&query=queryData)
For the specific calling method, please see the HTTP interface list.
***
#### Official Website
Official website: [https://alltick.co/](https://alltick.co/)
# Interface Restriction Description
Source: https://alltick.co/apis/en/integration-process/interface-restriction-description
This page summarizes interface restrictions for AllTick market data APIs, including HTTP and WebSocket rate limits, concurrent connection caps, response size constraints, and account-level limits, with links to error code docs, helping developers design request patterns that avoid throttling or rejections when pulling realtime data.
# Market API Address Description
Source: https://alltick.co/apis/en/integration-process/market-address-description
This page documents AllTick HTTP, REST, and WebSocket market data endpoints and base paths for different markets, helping developers configure domains and URLs before integration.
# Integration Process
Source: https://alltick.co/apis/en/integration-process/process
This page explains Integration Process, covering AllTick API integration flow, token setup, standard headers, endpoint addresses, rate limits and error codes.
#### Step 1: **Understand API addresses and parameters**
* **Goal**: Understand the URL structure of each interface and the parameters it expects.
* **Action**: Read the market API address documents carefully and learn the access URL and required parameters for each interface.
#### Step 2: Apply for your token
* **Goal**: Obtain the credential required to access the interfaces.
* **Action**: Follow the guide to apply for your dedicated Token so your requests can be authenticated successfully.
#### Step 3: **Understand interface call limits**
* **Goal**: Avoid request failures caused by violating limits.
* **Action**: Read the interface restriction description and pay attention to request frequency, data volume, and related limits.
#### Step 4: **Master request and response formats**
* **Goal**: Ensure that requests can be constructed correctly and responses can be parsed properly.
* **Action**: Read the common standard header documents to understand how JSON and other data formats are sent and received.
#### Step 5: **Choose target product codes**
* **Goal**: Determine the specific stock or financial product codes you want to query.
* **Action**: Refer to the code list document and select the product codes you are interested in.
#### Step 6: **Send requests and obtain data**
* **Goal**: Use the preparation above to obtain the market data you need.
* **Action**: Prepare the request URL and parameters based on the previous steps, then send the request to retrieve the target data.
#### Practical Suggestions
* **Keep it private**: Protect your Token carefully and avoid exposing it to unauthorized users.
* **Monitor updates**: Check API documentation updates regularly so you can learn about changes and new features in time.
* **Test first**: Before using the interface in production, validate your requests in a test environment and make sure everything works as expected.
* **Give feedback**: If you encounter problems, contact technical support promptly and provide a detailed issue description.
Following this process helps you use the interfaces more efficiently to access stock and financial market data.
***
### Official Website
Official website: [https://alltick.co/](https://alltick.co/)
# Product Code List
Source: https://alltick.co/apis/en/integration-process/product-code-list
This page serves as an entry point to product code lists for all markets supported by AllTick, including forex, US stocks, Hong Kong stocks, China A-shares, commodity futures, and cryptocurrencies, describing naming conventions and market identifiers so developers can quickly locate the correct symbols for multi-market tick and K-line APIs.
# REST Quotes API Address Description
Source: https://alltick.co/apis/en/integration-process/rest-quotes-api-address-description
Market base URLs, resource paths, and X-API-Key authentication for the AllTick REST Quotes API.
## API Address Description
The REST Quotes API uses HTTPS. Select the base URL for the product type, then append the appropriate `/v1/...` resource path. The REST API authenticates with the `X-API-Key` request header, not the legacy HTTP Quotes API's `token` query parameter.
### Stock Market REST API Address
For US stocks, Hong Kong stocks, A-shares, and major index data:
**Base URL:** `https://quote.alltick.co/quote-stock-b-api`
Single-product K-line request example:
```text theme={null}
GET https://quote.alltick.co/quote-stock-b-api/v1/kline/{queryData}
```
Batch K-line request example:
```text theme={null}
POST https://quote.alltick.co/quote-stock-b-api/v1/batch-kline
```
The stock product information endpoint is available only for US stocks, Hong Kong stocks, and A-shares: `https://quote.alltick.co/quote-stock-b-api/v1/stock-info`.
### Forex, Precious Metals, Cryptocurrency, and Other Markets REST API Address
For forex, precious metals, cryptocurrencies, crude oil, CFD indices, and commodities:
**Base URL:** `https://quote.alltick.co/quote-b-api`
Single-product K-line request example:
```text theme={null}
GET https://quote.alltick.co/quote-b-api/v1/kline/{queryData}
```
Batch K-line request example:
```text theme={null}
POST https://quote.alltick.co/quote-b-api/v1/batch-kline
```
The full URLs for the latest quote and latest order book endpoints are:
| Product type | Latest quote | Latest order book |
| - | - | - |
| US stocks, Hong Kong stocks, A-shares, and major index data | `https://quote.alltick.co/quote-stock-b-api/v1/quote` | `https://quote.alltick.co/quote-stock-b-api/v1/depth` |
| Forex, precious metals, cryptocurrencies, crude oil, CFD indices, and commodities | `https://quote.alltick.co/quote-b-api/v1/quote` | `https://quote.alltick.co/quote-b-api/v1/depth` |
Both endpoints use POST, with the product list and other request data in a JSON body. Their URLs do not include a `{queryData}` path parameter. Single-product K-lines still use GET with encoded `queryData` in the URL path.
### Suspension and Resumption API Addresses
The suspension and resumption endpoints use `/v1/trading-status/...` directly under the domain. **Do not append** this path to either market base URL:
```text theme={null}
GET https://quote.alltick.co/v1/trading-status/sse/{page}/{size}
GET https://quote.alltick.co/v1/trading-status/nyse/{page}/{size}
GET https://quote.alltick.co/v1/trading-status/nasdaq/{page}/{size}
```
### Authentication
Include your API key in the request header for every request:
```http theme={null}
X-API-Key: YOUR_API_KEY
```
For request parameters and response fields, see the [REST API documentation](/apis/en/rest-api). For code samples, see the [REST API request examples](/apis/en/rest-api/rest-request-example).
***
#### Official Website
Official website: [https://alltick.co/](https://alltick.co/)
# Token Application
Source: https://alltick.co/apis/en/integration-process/token-application
This page explains how to register an AllTick account and apply for an API Token, including opening the token application entry, submitting email and password, finding API keys in the dashboard, securely saving your token, and key security notes, so developers can obtain valid credentials to access real-time forex, stock, crypto, and other market data APIs.
## Application Process
### Step 1 - Fill in registration information
Token application URL: [https://alltick.co/register](https://alltick.co/register)
1. **Visit the registration page**: Go to the [Token application URL](https://alltick.co/register) to start registration.
2. **Enter registration details**:
* **Email address**: Enter a valid email address for future communication and account verification.
* **Password**: Create a secure password. Use uppercase and lowercase letters, special characters, and numbers to improve account security.
* **Email verification code**: Enter the verification code sent to your email. If you do not see the code, check your spam folder.
3. **Complete registration**: After confirming the information is correct, click the registration button. The system will process the registration and redirect you to the dashboard after success.
## Step 2 - Get the API Token
1. **Open the dashboard**: After registration, the system automatically navigates to the dashboard.
2. **Find the Token**: In the dashboard, go to the API keys section. You will find the newly generated API Token there.
3. **Record the Token**: Copy and store your Token securely. You need this Token for authentication when calling APIs.
#### Notes
* Keep your Token secure and do not share it with untrusted third parties.
* If you encounter any issue during registration or Token generation, contact customer support immediately.
* Always use the latest Token for API calls to avoid data access issues caused by expiration or invalidation.
By following the steps above, you can complete the Token application process and obtain the permissions required to access the API.
***
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# Common Standard Header Description
Source: https://alltick.co/apis/en/integration-process/universal-standard-header-description
This page defines the universal standard headers used by AllTick market data APIs, detailing the common HTTP and WebSocket header fields, meanings, and examples, so developers can consistently set token, language, compression, and other shared headers when accessing realtime forex, stock, and crypto data.
# WebSocket Common Standard Header
Source: https://alltick.co/apis/en/integration-process/websocket-common-standard-header
This page defines the common standard headers and connection parameters for AllTick WebSocket market data interfaces, covering authentication-related fields, protocol version, compression, and more, so developers can establish secure and compatible connections for realtime quote streaming.
## Common Request Header Description
| Field | Name | Type | Required | Description |
| - | - | - | - | - |
| cmd\_id | Protocol number | uint32 | Provided in each interface definition | |
| seq\_id | Sequence number | uint32 | Yes | Generated uniquely by the requester. The response keeps the same value as the request. |
| trace | Trace ID | string | Yes | Generated uniquely by the requester. The response keeps the same value as the request. Maximum length: 64. |
| data | Data body | object | Yes | See each interface definition for the specific data format. |
```json theme={null}
{
"cmd_id": 22000,
"seq_id": 123,
"trace": "asdfsdfa",
"data": {}
}
```
## Common Response Header Description
| Field | Name | Type | Description |
| - | - | - | - |
| ret | Return value | int32 | [Error Code Description](/apis/en/getting-started/error-code-description) |
| msg | Message | string | Specific description of success or failure. |
| cmd\_id | Protocol number | uint32 | Provided in each interface definition. |
| seq\_id | Sequence number | uint32 | Generated uniquely by the requester. The response keeps the same value as the request. |
| trace | Trace ID | string | Generated uniquely by the requester. The response keeps the same value as the request. Maximum length: 64. |
| data | Data body | object | See each interface definition for the specific data format. |
```json theme={null}
{
"ret": 201,
"msg": "request header param invalid",
"cmd_id": 0,
"seq_id": 0,
"trace": "",
"data": {}
}
```
***
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# WebSocket Quotes API Address Description
Source: https://alltick.co/apis/en/integration-process/websocket-quotes-api-address-description
This page explains WebSocket Quotes API Address Description, covering AllTick API integration flow, token setup, standard headers, endpoint addresses, rate limits and error codes.
## Stock Market Data WebSocket Subscription
**Interface Address**
* **Base Path**: `/quote-stock-b-ws-api`
* **Full URL**: `wss://quote.alltick.co/quote-stock-b-ws-api`
**Authentication Information**
Each time you establish a connection, you must append your authentication token to the URL as shown below:
```arduino theme={null}
wss://quote.alltick.co/quote-stock-b-ws-api?token=your_token
```
**Subscription Description**
After the connection succeeds, you can subscribe to specific stock market data as needed. For detailed calling methods, please refer to our WebSocket interface list.
***
## Forex, Cryptocurrency, and Commodity Market Data WebSocket Subscription
**Interface Address**
* **Base Path**: `/quote-b-ws-api`
* **Full URL**: `wss://quote.alltick.co/quote-b-ws-api`
**Authentication Information**
When establishing a connection, you also need to append your authentication token to the URL to ensure data transmission security. The correct format is as follows:
```arduino theme={null}
wss://quote.alltick.co/quote-b-ws-api?token=your_token
```
**Subscription Description**
Once the connection is established, you can subscribe to market data for forex, cryptocurrencies (digital currencies), and commodities (precious metals) as needed. For specific interface calling methods, please see our WebSocket interface list.
***
**Notes**: For the security of your account, please keep your token information safe. If you need further assistance or have any questions, please feel free to contact our technical support team.
***
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# A-Shares
Source: https://alltick.co/apis/en/product-codes/a-shares
This page lists the A-share product codes supported by AllTick, including Shanghai and Shenzhen stocks and major indices, with code formats and examples, helping developers set the correct code field when requesting realtime quotes, order book, or historical data for China A-share markets.
Complete A-share (Shanghai and Shenzhen markets) product code list:
Codes that can be found in the product list are supported by AllTick. Codes that cannot be found are currently not supported.
## Code Examples
| Name | Code |
| - | - |
| Tianmao Group | 000627.SZ |
| Xiangdian Co., Ltd. | 600416.SH |
| Tianqi Co., Ltd. | 002009.SZ |
| Grinm Advanced Materials | 600206.SH |
| Kangxin New Materials | 600076.SH |
| Veken Technology | 600152.SH |
| Baoxin Energy | 000690.SZ |
| Bohai Leasing | 000415.SZ |
| Vatti Corporation | 002035.SZ |
| Fangda Group | 000055.SZ |
# Commodities
Source: https://alltick.co/apis/en/product-codes/commodities
This page provides the commodity and precious metal product codes supported by AllTick, including major commodity futures and precious metal contracts with their symbol formats and examples, helping developers set the correct code when requesting realtime and historical data for these markets.
Complete commodity product code list covering precious metals and crude oil:
Codes that can be found in the product list are supported by AllTick. Codes that cannot be found are currently not supported.
## Code Examples
| Name | Code |
| - | - |
| Brent Crude Oil | UKOIL |
| US Crude Oil | USOIL |
| Silver | Silver |
| Aluminum | Aluminum |
| Gold | GOLD |
| Copper | COPPER |
| Natural Gas | NGAS |
| Palladium | Palladium |
| Platinum | Platinum |
| Nickel | Nickel |
# Crypto
Source: https://alltick.co/apis/en/product-codes/crypto
This page lists cryptocurrency and digital asset trading pair codes supported by AllTick, including major coins and common pairs with symbol formats and examples, helping developers set the correct code when requesting realtime and historical crypto tick and K-line data.
Complete cryptocurrency product code list:
Codes that can be found in the product list are supported by AllTick. Codes that cannot be found are currently not supported.
## Code Examples
| Name | Code |
| - | - |
| Bitcoin / USDT | BTCUSDT |
| Ethereum / USDT | ETHUSDT |
| Solana / USDT | SOLUSDT |
# Forex
Source: https://alltick.co/apis/en/product-codes/forex
This page lists forex product codes supported by AllTick, including major currency pairs and common FX contracts with symbol formats and examples, helping developers specify the correct code when requesting realtime quotes, tick, and K-line data for FX markets.
Complete forex product code list:
Codes that can be found in the product list are supported by AllTick. Codes that cannot be found are currently not supported.
## Code Examples
| Name | Code |
| - | - |
| EUR / USD | EURUSD |
| USD / JPY | USDJPY |
| GBP / USD | GBPUSD |
| AUD / USD | AUDUSD |
# HK Stocks
Source: https://alltick.co/apis/en/product-codes/hk-stocks
This page lists Hong Kong stock and index codes supported by AllTick, with symbol formats and examples, helping developers set the proper code values when requesting realtime quotes, order book, and historical K-line data for HK markets.
Complete Hong Kong stock product code list:
Codes that can be found in the product list are supported by AllTick. Codes that cannot be found are currently not supported.
## Code Examples
| Name | Code |
| - | - |
| Tencent Holdings | 700.HK |
| Alibaba | 9988.HK |
| ICBC | 1398.HK |
| China Construction Bank | 939.HK |
| Agricultural Bank of China | 1288.HK |
| PetroChina | 857.HK |
| China Mobile | 941.HK |
| Meituan | 3690.HK |
| Bank of China | 3988.HK |
| China Merchants Bank | 3968.HK |
# US Stocks
Source: https://alltick.co/apis/en/product-codes/us-stocks
This page provides US stock and index codes supported by AllTick, covering major exchanges such as NASDAQ and NYSE, with symbol formats and examples, so developers can set correct code values when accessing US market realtime and historical data APIs.
Complete US stock product code list:
Codes that can be found in the product list are supported by AllTick. Codes that cannot be found are currently not supported.
## Code Examples
| Name | Code |
| - | - |
| Apple | AAPL.US |
| Microsoft | MSFT.US |
| Amazon | AMZN.US |
| NVIDIA | NVDA.US |
| Tesla | TSLA.US |
# REST API
Source: https://alltick.co/apis/en/rest-api
## 1. Overview
The AllTick REST API documentation covers K-lines, batch K-lines, latest order-book depth, latest trade prices, basic stock product information, and suspension and resumption queries.
## 2. Basic information
### 2.1 Base URL
| Product type | Base URL |
| - | - |
| US stocks, Hong Kong stocks, A-shares, and major indices | `https://quote.alltick.co/quote-stock-b-api` |
| Forex, precious metals, cryptocurrencies, crude oil, CFD indices, and commodities | `https://quote.alltick.co/quote-b-api` |
### 2.2 Authentication
```http theme={null}
X-API-Key: {token}
```
### 2.3 Common request header
| Header | Required | Description |
| - | - | - |
| `X-API-Key` | Yes | Authentication token |
## 3. Resources and endpoints
```text theme={null}
/v1/kline # Single-product K-lines
/v1/batch-kline # Batch K-lines
/v1/quote # Latest quote (POST, JSON body)
/v1/depth # Latest order book (POST, JSON body)
/v1/stock-info # Basic stock information
/v1/trading-status/sse # SSE suspension and resumption
/v1/trading-status/nyse # NYSE suspension and resumption
/v1/trading-status/nasdaq # NASDAQ suspension and resumption
```
# Batch K-lines
Source: https://alltick.co/apis/en/rest-api/batch-kline
### Endpoint description
Batch query multiple products and K-line types (such as 1-minute, 15-minute, or 30-minute bars) in one request. Only the latest two bars can be retrieved.
```http theme={null}
POST /v1/batch-kline
```
| Product type | Request URL |
| - | - |
| US stocks, Hong Kong stocks, A-shares, and major indices | `https://quote.alltick.co/quote-stock-b-api/v1/batch-kline` |
| Forex, precious metals, cryptocurrencies, crude oil, CFD indices, and commodities | `https://quote.alltick.co/quote-b-api/v1/batch-kline` |
### Request parameters
| Parameter | Type | Required | Description |
| - | - | - | - |
| `X-API-Key` | string | Yes | Authentication token |
| `body` | string | Yes | Request content |
### body request content
```json theme={null}
{
"trace": "c2a8a146-a647-4d6f-ac07-8c4805bf0b74",
"data": {
"symbol_list": [
{
"code": "700.HK",
"kline_type": 1,
"kline_timestamp_end": 0,
"query_kline_num": 1,
"adjust_type": 0
},
{
"code": "GOOGL.US",
"kline_type": 1,
"kline_timestamp_end": 0,
"query_kline_num": 1,
"adjust_type": 0
}
]
}
}
```
| Name | Type | Required | Description |
| - | - | - | - |
| `trace` | string | Yes | Unique trace ID for locating logs; use a distinct value for each request |
| `data` | object | Yes | Request data |
| `symbol_list` | array | Yes | List of products and K-line conditions |
| `code` | string | Yes | Product code; case must match the product list |
| `kline_type` | integer | Yes | K-line type; 1–10 represent 1-minute through monthly bars |
| `kline_timestamp_end` | integer | Yes | 0 queries backward from the latest trading day |
| `query_kline_num` | integer | Yes | This endpoint retrieves at most two bars |
| `adjust_type` | integer | Yes | Stock adjustment type; only 0 is currently supported |
### Response example
```json theme={null}
{
"ret": 200,
"msg": "ok",
"trace": "c2a8a146-a647-4d6f-ac07-8c4805bf0b74",
"data": {
"kline_list": [
{
"code": "700.HK",
"kline_type": 1,
"kline_data": [{"timestamp":"1677829200","open_price":"136.421","close_price":"136.412","high_price":"136.422","low_price":"136.407","volume":"0","turnover":"0"}]
},
{
"code": "GOOGL.US",
"kline_type": 1,
"kline_data": [{"timestamp":"1677829200","open_price":"136.421","close_price":"136.412","high_price":"136.422","low_price":"136.407","volume":"0","turnover":"0"}]
}
]
}
}
```
### Response fields
The response contains `ret`, `msg`, `trace`, and `data.kline_list`. Each item includes `code`, `kline_type`, and `kline_data`; each bar has `timestamp`, `open_price`, `close_price`, `high_price`, `low_price`, `volume`, and `turnover`.
# POST /v1/batch-kline Debug Module
Source: https://alltick.co/apis/en/rest-api/debug/batch-kline
apis/api-reference/openapi-rest-en.json POST /quote-stock-b-api/v1/batch-kline
## POST /v1/batch-kline Debug Module
# POST /v1/depth Debug Module
Source: https://alltick.co/apis/en/rest-api/debug/depth
apis/api-reference/openapi-rest-en.json POST /quote-stock-b-api/v1/depth
## POST /v1/depth Debug Module
# GET /v1/kline Debug Module
Source: https://alltick.co/apis/en/rest-api/debug/kline
apis/api-reference/openapi-rest-en.json GET /quote-stock-b-api/v1/kline/{queryData}
## GET /v1/kline Debug Module
# POST /v1/quote Debug Module
Source: https://alltick.co/apis/en/rest-api/debug/quote
apis/api-reference/openapi-rest-en.json POST /quote-stock-b-api/v1/quote
## POST /v1/quote Debug Module
# POST /v1/stock-info Debug Module
Source: https://alltick.co/apis/en/rest-api/debug/stock-info
apis/api-reference/openapi-rest-en.json POST /quote-stock-b-api/v1/stock-info
## POST /v1/stock-info Debug Module
# GET /v1/trading-status/nasdaq Debug Module
Source: https://alltick.co/apis/en/rest-api/debug/suspension-nasdaq
apis/api-reference/openapi-rest-en.json GET /quote-stock-b-api/v1/trading-status/nasdaq/{page}/{size}
## GET /v1/trading-status/nasdaq Debug Module
# GET /v1/trading-status/nyse Debug Module
Source: https://alltick.co/apis/en/rest-api/debug/suspension-nyse
apis/api-reference/openapi-rest-en.json GET /quote-stock-b-api/v1/trading-status/nyse/{page}/{size}
## GET /v1/trading-status/nyse Debug Module
# GET /v1/trading-status/sse Debug Module
Source: https://alltick.co/apis/en/rest-api/debug/suspension-sse
apis/api-reference/openapi-rest-en.json GET /quote-stock-b-api/v1/trading-status/sse/{page}/{size}
## GET /v1/trading-status/sse Debug Module
# Latest order book
Source: https://alltick.co/apis/en/rest-api/depth-tick
### Endpoint description
Query the maximum available order-book depth for each product type.
```http theme={null}
POST /v1/depth
```
| Product type | Request URL |
| - | - |
| US stocks, Hong Kong stocks, A-shares, and major indices | `https://quote.alltick.co/quote-stock-b-api/v1/depth` |
| Forex, precious metals, cryptocurrencies, crude oil, CFD indices, and commodities | `https://quote.alltick.co/quote-b-api/v1/depth` |
### Request parameters
| Parameter | Type | Required | Description |
| - | - | - | - |
| `X-API-Key` | string | Yes | Authentication token in the request header |
| `body` | string | Yes | JSON request content |
### Request body
```json theme={null}
{
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"symbol_list": [{"code": "857.HK"}, {"code": "UNH.US"}]
}
}
```
| Name | Type | Required | Description |
| - | - | - | - |
| `trace` | string | Yes | Request trace ID |
| `data` | object | Yes | Request data |
| `symbol_list` | array | Yes | Product list |
| `code` | string | No | Product code; case must match the product list |
### Response example
```json theme={null}
{
"ret": 200,
"msg": "ok",
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"tick_list": [{"code":"857.HK","seq":"30686349","tick_time":"1677830357227","bids":[{"price":"136.424","volume":"100000.00"}],"asks":[{"price":"136.427","volume":"400000.00"}]}]
}
}
```
### Response fields
`tick_list` contains `code`, `seq`, `tick_time`, `bids`, and `asks`; each bid or ask level has `price` and `volume`. Some CFD indices do not provide `volume`; forex, precious metals, energy, stocks, and cryptocurrencies do.
# HTTP Request Example
Source: https://alltick.co/apis/en/rest-api/http-request-example
This page provides HTTP request examples for the AllTick REST API in Go, Python, Java, and PHP, showing how to build request URLs, set token and query parameters, send HTTP requests, and parse responses, making it easy for developers to integrate and test real-time tick data feeds for forex, stocks, crypto, and more via REST.
```go Go theme={null}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func http_example() {
/*
URL-encode the following JSON and copy it into the query field of the HTTP query string
{"trace" : "go_http_test1","data" : {"code" : "700.HK","kline_type" : 1,"kline_timestamp_end" : 0,"query_kline_num" : 2,"adjust_type": 0}}
Special Note:
github: https://github.com/AllTick-Official/alltick-realtime-forex-crypto-stock-tick-finance-websocket-api
Token Application: https://alltick.co
Replace testtoken in the URL below with your own token
API address for forex, cryptocurrencies, and precious metals:
https://quote.alltick.co/quote-b-api
Stock API address:
https://quote.alltick.co/quote-stock-b-api
*/
url := "https://quote.alltick.co/quote-stock-b-api/kline"
log.Println("Request URL:", url)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
q := req.URL.Query()
token := "testtoken"
q.Add("token", token)
queryStr := `{"trace":"1111111111111111111111111","data":{"code":"AAPL.US","kline_type":1,"kline_timestamp_end":0,"query_kline_num":10,"adjust_type":0}}`
q.Add("query", queryStr)
req.URL.RawQuery = q.Encode()
// Send request
resp, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body2, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Println("Failed to read response:", err)
return
}
log.Println("Response content:", string(body2))
}
```
```java Java theme={null}
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class HttpJavaExample {
public static void main(String[] args) {
try {
/*
Encode the following JSON into URL format and copy it to the query field of the HTTP request
{"trace" : "java_http_test1","data" : {"code" : "700.HK","kline_type" : 1,"kline_timestamp_end" : 0,"query_kline_num" : 2,"adjust_type": 0}}
Special Note:
GitHub: https://github.com/AllTick-Official/alltick-realtime-forex-crypto-stock-tick-finance-websocket-api
Token Application: https://alltick.co
Replace "testtoken" in the URL below with your own token
API addresses for forex, cryptocurrencies, and precious metals:
https://quote.alltick.co/quote-b-api
Stock API address:
https://quote.alltick.co/quote-stock-b-api
*/
String url = "http://quote.alltick.co/quote-stock-b-api/kline?token=testtoken&query="
+ "%7B%22trace%22%20%3A%20%22java_http_test1%22%2C%22data%22%20%3A%20%7B"
+ "%22code%22%20%3A%20%22700.HK%22%2C%22kline_type%22%20%3A%201%2C"
+ "%22kline_timestamp_end%22%20%3A%200%2C%22query_kline_num%22%20%3A%202%2C"
+ "%22adjust_type%22%3A%200%7D%7D";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
System.out.println("Response Code: " + responseCode);
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
```
```php PHP theme={null}
10, CURLOPT_RETURNTRANSFER => 1, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false);
/* Set specific parameters based on request type */
switch (strtoupper($method)) {
case 'GET':
$opts[CURLOPT_URL] = $url.'&query='.rawurlencode($params);
$opts[CURLOPT_CUSTOMREQUEST] = 'GET';
break;
default:
}
/* Initialize and execute curl request */
$ch = curl_init();
curl_setopt_array($ch, $opts);
$data = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if ($error) {
$data = null;
}
echo $data;
?>
```
```python Pyton theme={null}
import time
import requests
import json
# Extra headers
test_headers = {
'Content-Type': 'application/json'
}
'''
# Special Note:
# GitHub: https://github.com/AllTick-Official/alltick-realtime-forex-crypto-stock-tick-finance-websocket-api
# Token Application: https://alltick.co
# Replace "testtoken" in the URL below with your own token
# API addresses for forex, cryptocurrencies, and precious metals:
# https://quote.alltick.co/quote-b-ws-api
# Stock API address:
# https://quote.alltick.co/quote-stock-b-ws-api
Encode the following JSON and copy it to the "query" field of the HTTP query string
{"trace": "python_http_test1", "data": {"code": "700.HK", "kline_type": 1, "kline_timestamp_end": 0, "query_kline_num": 2, "adjust_type": 0}}
{"trace": "python_http_test2", "data": {"symbol_list": [{"code": "700.HK"}, {"code": "UNH.US"}]}}
{"trace": "python_http_test3", "data": {"symbol_list": [{"code": "700.HK"}, {"code": "UNH.US"}]}}
'''
test_url1 = (
'https://quote.alltick.co/quote-stock-b-api/kline?token=testtoken&query='
'%7B%22trace%22%20%3A%20%22python_http_test1%22%2C%22data%22%20%3A%20%7B'
'%22code%22%20%3A%20%22700.HK%22%2C%22kline_type%22%20%3A%201%2C'
'%22kline_timestamp_end%22%20%3A%200%2C%22query_kline_num%22%20%3A%202%2C'
'%22adjust_type%22%3A%200%7D%7D'
)
test_url2 = (
'https://quote.alltick.co/quote-stock-b-api/depth-tick?token=testtoken&query='
'%7B%22trace%22%20%3A%20%22python_http_test2%22%2C%22data%22%20%3A%20%7B'
'%22symbol_list%22%3A%20%5B%7B%22code%22%3A%20%22700.HK%22%7D%2C'
'%7B%22code%22%3A%20%22UNH.US%22%7D%5D%7D%7D'
)
test_url3 = (
'https://quote.alltick.co/quote-stock-b-api/trade-tick?token=testtoken&query='
'%7B%22trace%22%20%3A%20%22python_http_test3%22%2C%22data%22%20%3A%20%7B'
'%22symbol_list%22%3A%20%5B%7B%22code%22%3A%20%22700.HK%22%7D%2C'
'%7B%22code%22%3A%20%22UNH.US%22%7D%5D%7D%7D'
)
resp1 = requests.get(url=test_url1, headers=test_headers)
time.sleep(1)
resp2 = requests.get(url=test_url2, headers=test_headers)
time.sleep(1)
resp3 = requests.get(url=test_url3, headers=test_headers)
# Decoded text returned by the request
text1 = resp1.text
print(text1)
text2 = resp2.text
print(text2)
text3 = resp3.text
print(text3)
```
***
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# REST API Overview
Source: https://alltick.co/apis/en/rest-api/introduction
Learn REST API Overview for AllTick REST API, including HTTP request patterns, interface list, parameters, response fields and runnable debug modules for US stocks, Hong Kong stocks, A-shares, forex, crypto, and commodities market data.
## Overview
The AllTick REST API documentation includes two interface systems:
* **HTTP Interface API**: the legacy HTTP market-data interfaces organized according to the official API documentation.
* **REST API**: the newer `/v1/...` REST endpoints using the `X-API-Key` request header and independent debug pages.
The two systems have independent paths, authentication methods, and request parameters. Choose the documentation that matches your integration version.
View Go, Java, PHP, and Python examples using the REST API and X-API-Key authentication.
View K-line, quote, depth, stock information, and trading-status REST API endpoints.
View REST API request examples for Go, Java, PHP, and Python.
View official-documentation-consistent HTTP interface descriptions and debuggable interface pages.
## REST API Basics
REST API requests use the following authentication header:
```http theme={null}
X-API-Key: YOUR_API_KEY
```
Key REST API resources include:
```text theme={null}
/v1/kline/{queryData}
/v1/batch-kline
/v1/quote # POST, JSON body
/v1/depth # POST, JSON body
/v1/stock-info
/v1/trading-status/{exchange}/{page}/{size}
```
## Interface Addresses
| Product Type | Base URL |
| - | - |
| US stocks, Hong Kong stocks, A shares, and major index data | `https://quote.alltick.co/quote-stock-b-api` |
| Forex, precious metals, cryptocurrencies, crude oil, CFD indices, and commodities | `https://quote.alltick.co/quote-b-api` |
# Single-product K-lines
Source: https://alltick.co/apis/en/rest-api/kline
### Endpoint description
Query historical K-lines for one product per request.
```http theme={null}
GET /v1/kline/{queryData}
```
**US stocks, Hong Kong stocks, A-shares, and major indices — request example:**
`https://quote.alltick.co/quote-stock-b-api/v1/kline/{queryData}`
**Forex, precious metals, cryptocurrencies, crude oil, CFD indices, and commodities — request example:**
`https://quote.alltick.co/quote-b-api/v1/kline/{queryData}`
### Request parameters
| Parameter | Type | Required | Description |
| - | - | - | - |
| `X-API-Key` | string | Yes | Authentication token |
| `queryData` | string | Yes | Request content |
#### queryData
```json theme={null}
{
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {
"code": "857.HK",
"kline_type": 1,
"kline_timestamp_end": 0,
"query_kline_num": 2,
"adjust_type": 0
}
}
```
| Name | Type | Required | Description |
| - | - | - | - |
| `trace` | string | Yes | Unique trace ID for locating logs; use a distinct value for each request |
| `data` | object | Yes | Request data |
| `code` | string | Yes | Product code; case must match the product list |
| `kline_type` | integer | Yes | 1=1 minute, 2=5 minutes, 3=15 minutes, 4=30 minutes, 5=1 hour, 6=2 hours, 7=4 hours, 8=daily, 9=weekly, 10=monthly; stocks do not support 2-hour or 4-hour bars |
| `kline_timestamp_end` | integer | Yes | 0 queries backward from the latest trading day; forex, precious metals, and cryptocurrencies support a timestamp, while stocks do not |
| `query_kline_num` | integer | Yes | Up to 500 bars per request; to query yesterday's close, use 2 and set `kline_type` to 8 |
| `adjust_type` | integer | Yes | Stock adjustment type: 0=ex-rights, 1=forward-adjusted; only 0 is currently supported |
### Response example
```json theme={null}
{
"ret": 200,
"msg": "ok",
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {
"code": "857.HK",
"kline_type": 1,
"kline_list": [
{
"timestamp": "1677829200",
"open_price": "136.421",
"close_price": "136.412",
"high_price": "136.422",
"low_price": "136.407",
"volume": "0",
"turnover": "0"
},
{
"timestamp": "1677829260",
"open_price": "136.412",
"close_price": "136.401",
"high_price": "136.415",
"low_price": "136.397",
"volume": "0",
"turnover": "0"
}
]
}
}
```
### Response fields
| Name | Type | Description |
| - | - | - |
| `ret` | integer | Response code |
| `msg` | string | Response message |
| `trace` | string | Request trace ID |
| `code` | string | Product code |
| `kline_type` | integer | K-line type |
| `kline_list` | array | K-line list |
| `timestamp` | string | K-line timestamp |
| `open_price` | string | Open price |
| `close_price` | string | Close price; the latest bar during trading also represents the latest trade price, and outside trading hours it represents the closing price |
| `high_price` | string | High price |
| `low_price` | string | Low price |
| `volume` | string | Traded volume |
| `turnover` | string | Traded amount |
# REST API Request Example
Source: https://alltick.co/apis/en/rest-api/rest-request-example
Go, Java, PHP, and Python request examples for the AllTick REST API.
REST API uses the `X-API-Key` request header for authentication. The following examples call the single-product K-line endpoint; replace `YOUR_API_KEY` with your actual API key.
```go Go theme={null}
package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
queryData := `{"trace":"test-001","data":{"code":"700.HK","kline_type":1,"kline_timestamp_end":0,"query_kline_num":2,"adjust_type":0}}`
endpoint := "https://quote.alltick.co/quote-stock-b-api/v1/kline/" + url.PathEscape(queryData)
req, _ := http.NewRequest(http.MethodGet, endpoint, nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req); if err != nil { panic(err) }; defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body); fmt.Println(resp.StatusCode, string(body))
}
```
```java Java theme={null}
import java.net.URI;
import java.net.http.*;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
class RestApiExample {
public static void main(String[] args) throws Exception {
String query = "{\"trace\":\"test-001\",\"data\":{\"code\":\"700.HK\",\"kline_type\":1,\"kline_timestamp_end\":0,\"query_kline_num\":2,\"adjust_type\":0}}";
String endpoint = "https://quote.alltick.co/quote-stock-b-api/v1/kline/" + URLEncoder.encode(query, StandardCharsets.UTF_8);
HttpRequest request = HttpRequest.newBuilder(URI.create(endpoint)).header("X-API-Key", "YOUR_API_KEY").GET().build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode()); System.out.println(response.body());
}
}
```
```php PHP theme={null}
"test-001", "data" => ["code" => "700.HK", "kline_type" => 1, "kline_timestamp_end" => 0, "query_kline_num" => 2, "adjust_type" => 0]]);
$ch = curl_init("https://quote.alltick.co/quote-stock-b-api/v1/kline/" . rawurlencode($queryData));
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: YOUR_API_KEY"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL . $body; curl_close($ch);
?>
```
```python Python theme={null}
import json
import requests
from urllib.parse import quote
query_data = {"trace": "test-001", "data": {"code": "700.HK", "kline_type": 1, "kline_timestamp_end": 0, "query_kline_num": 2, "adjust_type": 0}}
url = "https://quote.alltick.co/quote-stock-b-api/v1/kline/" + quote(json.dumps(query_data, separators=(",", ":")))
response = requests.get(url, headers={"X-API-Key": "YOUR_API_KEY"})
print(response.status_code); print(response.json())
```
## Batch K-line POST request
```bash theme={null}
curl --request POST \
--url https://quote.alltick.co/quote-stock-b-api/v1/batch-kline \
--header 'Content-Type: application/json' \
--header 'X-API-Key: YOUR_API_KEY' \
--data '{"trace":"test-001","data":{"symbol_list":[{"code":"700.HK","kline_type":1,"kline_timestamp_end":0,"query_kline_num":1,"adjust_type":0}]}}'
```
# Stock product information
Source: https://alltick.co/apis/en/rest-api/static-info
### Endpoint description
Batch query selected basic information for US stocks, Hong Kong stocks, and A-shares only.
```http theme={null}
POST /v1/stock-info
```
Request example:`https://quote.alltick.co/quote-stock-b-api/v1/stock-info`
### Request parameters
| Parameter | Type | Required | Description |
| - | - | - | - |
| `X-API-Key` | string | Yes | Authentication token |
| `body` | string | Yes | Request content |
### body request content
```json theme={null}
{
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"symbol_list": [{"code": "700.HK"}, {"code": "UNH.US"}]
}
}
```
| Name | Type | Required | Description |
| - | - | - | - |
| `trace` | string | Yes | Request trace ID |
| `data` | object | Yes | Request data |
| `symbol_list` | array | Yes | Product list |
| `code` | string | No | Product code; case must match the product list |
### Response example
```json theme={null}
{
"ret": 200,
"msg": "ok",
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"static_info_list": [{
"board": "HKEquity",
"bps": "101.7577888985738336",
"circulating_shares": "9267359712",
"currency": "HKD",
"dividend_yield": "3.4558141358352833",
"eps": "13.7190213011686429",
"eps_ttm": "18.0567016900844671",
"exchange": "SEHK",
"hk_shares": "9267359712",
"lot_size": "100",
"name_cn": "腾讯控股",
"name_en": "TENCENT",
"name_hk": "騰訊控股",
"symbol": "700.HK",
"total_shares": "9267359712"
}]
}
}
```
### Response fields
| Field | Type | Description |
| - | - | - |
| `board` | string | Stock market segment |
| `bps` | string | Book value per share |
| `circulating_shares` | string | Free-float shares |
| `currency` | string | Trading currency |
| `dividend_yield` | string | Dividend yield |
| `eps` | string | Earnings per share |
| `eps_ttm` | string | Earnings per share (TTM) |
| `exchange` | string | Product exchange |
| `hk_shares` | string | Hong Kong shares (Hong Kong stocks only) |
| `lot_size` | string | Shares per lot |
| `name_cn` | string | Simplified Chinese product name |
| `name_en` | string | English product name |
| `name_hk` | string | Traditional Chinese product name |
| `symbol` | string | Product code |
| `total_shares` | string | Total shares |
# HTTP Interface API
Source: https://alltick.co/apis/en/rest-api/stock-http-interface-api
Learn HTTP Interface API for AllTick REST API, including HTTP request patterns, interface list, parameters, response fields and runnable debug modules for US stocks, Hong Kong stocks, A-shares, forex, crypto, and commodities market data.
# Suspension and resumption information
Source: https://alltick.co/apis/en/rest-api/suspension
### Endpoint description
Query suspension and resumption information for major exchanges (SSE, NYSE, and NASDAQ). All endpoints return JSON sorted by announcement time in descending order.
```http theme={null}
GET /v1/trading-status/sse/{page}/{size}
GET /v1/trading-status/nyse/{page}/{size}
GET /v1/trading-status/nasdaq/{page}/{size}
```
### Request examples
```text theme={null}
https://quote.alltick.co/v1/trading-status/sse/{page}/{size}
https://quote.alltick.co/v1/trading-status/nyse/{page}/{size}
https://quote.alltick.co/v1/trading-status/nasdaq/{page}/{size}
```
### Request parameters
| Parameter | Type | Required | Description |
| - | - | - | - |
| `X-API-Key` | string | Yes | Authentication token |
| `page` | integer | Yes | Page number |
| `size` | integer | Yes | Page size |
### Response example
```json theme={null}
{
"success": true,
"timestamp": "2024-01-15T10:30:00",
"totalCount": 125,
"data": [{
"symbol": "600000",
"symbolName": "浦发银行",
"haltReason": "重大事项停牌",
"haltDate": "2024-01-15",
"haltTime": "09:30:00",
"haltPeriod": "全天停牌",
"resumeDate": "2024-01-16",
"resumeTime": "09:30:00",
"publishDate": "2024-01-14 18:00:00"
}]
}
```
### Response field descriptions
| Field name | Type | Required | Description |
| - | - | - | - |
| `success` | boolean | Yes | Whether the request succeeded |
| `timestamp` | string | Yes | Response timestamp (format: yyyy-MM-dd’T’HH:mm:ss) |
| `totalCount` | integer | Yes | Total number of records |
| `data` | array | Yes | Suspension and resumption records |
| `symbol` | string | No | Stock symbol |
| `symbolName` | string | Yes | Stock name |
| `haltReason` | string | Yes | Reason for suspension |
| `haltDate` | string | Yes | Suspension date |
| `haltTime` | string | Yes | Suspension time |
| `haltPeriod` | string | Yes | Suspension period |
| `resumeDate` | string | Yes | Resumption date |
| `resumeTime` | string | Yes | Resumption time |
| `publishDate` | string | No | Announcement time |
| `totalPages` | integer | No | Total pages (returned for paginated queries) |
| `currentPage` | integer | No | Current page (returned for paginated queries) |
| `currentSize` | integer | No | Number of records on the current page (returned for paginated queries) |
# Latest quote
Source: https://alltick.co/apis/en/rest-api/trade-tick
### Endpoint description
Batch query the latest trade price (the latest tick, also the current price) for multiple products. Historical tick prices are not supported.
```http theme={null}
POST /v1/quote
```
| Product type | Request URL |
| - | - |
| US stocks, Hong Kong stocks, A-shares, and major indices | `https://quote.alltick.co/quote-stock-b-api/v1/quote` |
| Forex, precious metals, cryptocurrencies, crude oil, CFD indices, and commodities | `https://quote.alltick.co/quote-b-api/v1/quote` |
### Request parameters
| Parameter | Type | Required | Description |
| - | - | - | - |
| `X-API-Key` | string | Yes | Authentication token in the request header |
| `body` | string | Yes | JSON request content |
### Request body
```json theme={null}
{
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"symbol_list": [{"code": "857.HK"}, {"code": "UNH.US"}]
}
}
```
| Name | Type | Required | Description |
| - | - | - | - |
| `trace` | string | Yes | Request trace ID |
| `data` | object | Yes | Request data |
| `symbol_list` | array | Yes | Product list |
| `code` | string | No | Product code; case must match the product list |
### Response example
```json theme={null}
{
"ret": 200,
"msg": "ok",
"trace": "edd5df80-df7f-4acf-8f67-68fd2f096426",
"data": {
"tick_list": [{"code":"857.HK","seq":"30841439","tick_time":"1677831545217","price":"136.302","volume":"0","turnover":"0","trade_direction":0}]
}
}
```
### Response fields
| Field | Type | Description |
| - | - | - |
| `code` | string | Product code |
| `seq` | string | Sequence number |
| `tick_time` | string | Timestamp |
| `price` | string | Trade price |
| `volume` | string | Traded volume |
| `turnover` | string | Traded amount |
| `trade_direction` | integer | 0=neutral, 1=buy, 2=sell; forex, precious metals, and energy return 1 by default |
# Cancel Quote Subscription
Source: https://alltick.co/apis/en/websocket/cancel-subscription
This documentation explains how to use AllTick’s stock WebSocket cancel quote subscription interface, including unsubscribe message format, parameters, and examples, allowing developers to stop receiving tick or order book updates for specific symbols and optimize bandwidth and quota usage.
## Interface Description
Cancel quote subscription.
## Request - Protocol Number: 22006
#### Data Definition
| Field | Name | Type | Required | Description |
| - | - | - | - | - |
| cancel\_type | Cancel type | uint32 | Yes | 0: cancel all quote subscriptions, 1: cancel order book quote subscription, 2: cancel trade quote subscription, 3: cancel exchange rate subscription |
### Data Structure (JSON)
```json theme={null}
{
"cmd_id": 22006,
"seq_id": 123,
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {
"cancel_type": 1
}
}
```
## Response - Protocol Number: 22007
### Data Structure (JSON)
```json theme={null}
{
"ret": 200,
"msg": "ok",
"cmd_id": 22007,
"seq_id": 123,
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {}
}
```
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# Latest Order Book (Real-time Tick-by-Tick Depth, Order Book) Subscription
Source: https://alltick.co/apis/en/websocket/depth-subscription
Subscribe to AllTick WebSocket latest order book streams for real-time bid-ask quotes, market depth and Order Book updates used by trading terminals and quant strategies.
## Interface Description
This interface supports subscription to the latest order book (real-time tick-by-tick depth, Order Book) data of products. It does not support historical order book data or historical tick-by-tick data.
Interface behavior: for each WebSocket connection, every time this request is sent, the backend overwrites the previous subscription request by default. For example, if you initially subscribed to products A, B, and C, and want to add E, F, and G, you need to resend A, B, C, E, F, and G together. After the subscription succeeds, data will be pushed.
Notes:
1. After a subscription succeeds once, you do not need to frequently initiate subscription requests again. You must send a heartbeat every 10 seconds, and the interface will push data in real time. If no heartbeat request is received within 30 seconds, it will be considered timed out and the requester’s WebSocket connection will be disconnected.
2. During integration, customers can add automatic reconnection logic to ensure the connection can automatically reconnect after disconnection caused by network or other reasons.
3. The following is the maximum order book depth for each product type:
3.1 For inactive products, the available depth may be smaller than the maximum levels listed below. This is normal.
3.2 One side of the order book may be empty. For example, when a stock reaches limit up or limit down, one side of the order book may be empty.
| | Forex, Precious Metals, Crude Oil | Cryptocurrencies | Hong Kong Stocks | US Stocks | A Shares |
| - | - | - | - | - | - |
| Depth description | Up to 1 level | Up to 5 levels | Up to 10 levels | Up to 1 level | Up to 5 levels |
## Interface Limitations
1. Be sure to read: [WebSocket Interface Limitations](/apis/en/getting-started/websocket-interface-limitations)
2. Be sure to read: [Error Code Description](/apis/en/getting-started/error-code-description)
## API Endpoints
**1. US Stocks, Hong Kong Stocks, A Shares, and Major Index Data API Endpoint:**
* Base Path: `/quote-stock-b-ws-api`
* Full URL: `wss://quote.alltick.co/quote-stock-b-ws-api`
**2. Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities API Endpoint:**
* Base Path: `/quote-b-ws-api`
* Full URL: `wss://quote.alltick.co/quote-b-ws-api`
## Request Examples
**1. Request example for US Stocks, Hong Kong Stocks, A Shares, and Major Index Data:**
Each time a connection is established, your authentication token must be appended to the URL as follows:
`wss://quote.alltick.co/quote-stock-b-ws-api?token=your_token`
After the connection succeeds, you can subscribe to specific stock market data as needed. For detailed calling methods, refer to the documentation below.
**2. Request example for Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities:**
Each time a connection is established, your authentication token must be appended to the URL as follows:
`wss://quote.alltick.co/quote-b-ws-api?token=your_token`
After the connection succeeds, you can subscribe to specific forex, cryptocurrency, precious metals, and commodity data as needed. For detailed calling methods, refer to the documentation below.
## Request - Protocol Number: 22002
#### JSON Definition
| Field | Name | Type | Required | Description |
| - | - | - | - | - |
| cmd\_id | Protocol number | integer | Yes | The latest order book request protocol number is fixed: 22002 |
| seq\_id | Response ID | integer | Yes | Subscription request identifier, returned in the response. Custom value; can be repeated for each request. |
| trace | Traceable ID | string | Yes | Traceable ID for request log information. Custom value; must 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 | For details, view the code list: [Click the code list](https://docs.google.com/spreadsheets/d/1avkeR1heZSj6gXIkDeBt8X3nv4EzJetw4yFuKjSDYtA/edit?gid=495387863#gid=495387863)
**Note: The code value must match the case of the code in the product list.** |
| depth\_level | Depth level | uint32 | No | If the depth\_level field is not provided, the backend provides only one level of quotes. If the requested level is greater than the actual quote depth, or if depth\_level is not provided, the backend returns as many levels as are actually available. |
### Data Structure (JSON)
```json theme={null}
{
"cmd_id": 22002,
"seq_id": 123,
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {
"symbol_list": [
{
"code": "BTCUSDT",
"depth_level": 5
},
{
"code": "ETHUSDT",
"depth_level": 5
}
]
}
}
```
## Response - Protocol Number: 22003
### Data Structure (JSON)
```json theme={null}
{
"ret": 200,
"msg": "ok",
"cmd_id": 22003,
"seq_id": 123,
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {}
}
```
## Push - Protocol Number: 22999
#### Data Definition
| Field | Name | Type | Description |
| - | - | - | - |
| code | Code | string | For details, view the code list: [Click the code list](https://docs.google.com/spreadsheets/d/1avkeR1heZSj6gXIkDeBt8X3nv4EzJetw4yFuKjSDYtA/edit?gid=495387863#gid=495387863) |
| seq | Quote sequence number | integer | |
| tick\_time | Quote timestamp | integer | Unit: milliseconds |
| bids | Bid depth | string | See the bids definition below. |
| asks | Ask depth | string | See the asks definition below. |
#### Bids Definition
| Field | Name | Type | Description |
| - | - | - | - |
| price | Best bid price, bid-side price | string | |
| volume | Best bid volume, bid-side volume | string | 1. Some CFD indices do not provide volume.
2. Forex, precious metals, energy, stocks, and cryptocurrencies all provide volume. |
#### Asks Definition
| Field | Name | Type | Description |
| - | - | - | - |
| price | Best ask price, ask-side price | string | |
| volume | Best ask volume, ask-side volume | string | 1. Some CFD indices do not provide volume.
2. Forex, precious metals, energy, stocks, and cryptocurrencies all provide volume. |
### Data Structure (JSON)
```json theme={null}
{
"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"
}
]
}
}
```
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# Heartbeat
Source: https://alltick.co/apis/en/websocket/heartbeat
This page describes the heartbeat mechanism of AllTick’s stock WebSocket API, showing Ping-Pong message formats and how to keep connections alive, detect disconnects, and reconnect, so developers can maintain stable WebSocket streams for realtime tick and order book data.
## Interface Description
The requester is required to send a heartbeat every 10 seconds. If no heartbeat request is received within 30 seconds, it will be considered timed out and the requester’s WebSocket connection will be disconnected.
## Request - Protocol Number: 22000
### Data Structure (JSON)
```json theme={null}
{
"cmd_id": 22000,
"seq_id": 123,
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {}
}
```
## Response - Protocol Number: 22001
### Data Structure (JSON)
```json theme={null}
{
"ret": 200,
"msg": "ok",
"cmd_id": 22001,
"seq_id": 123,
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {}
}
```
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# WebSocket API Overview
Source: https://alltick.co/apis/en/websocket/introduction
This documentation covers AllTick’s stock WebSocket interface, including realtime trade tick streaming, order book depth updates, subscription and cancel methods, heartbeat mechanism, and message format examples, enabling developers to build low-latency quote systems for US, HK, and China A-share markets.
The AllTick WebSocket API is used to receive real-time quote pushes. After a connection is established, the client sends a subscription request, and after the subscription succeeds, the server continuously pushes latest trade price and latest order book data. During the connection, heartbeats must be sent as required to avoid timeout disconnection.
## 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` |
Each time a connection is established, your authentication token must be appended to the URL. After the connection succeeds, send latest trade price or latest order book subscription requests as needed.
## Interface List
Subscribe to the latest trade price of products. After the subscription succeeds, trade data is pushed through protocol number 22998.
Subscribe to the latest order book depth of products. After the subscription succeeds, order book data is pushed through protocol number 22999.
Send a heartbeat every 10 seconds. If no heartbeat request is received within 30 seconds, the WebSocket connection will be disconnected.
Cancel all quote subscriptions, or cancel order book, trade, or exchange-rate subscriptions by type.
WebSocket does not support K-line push. K-lines can be polled or batch queried through HTTP interfaces.
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
1. Select the stock or non-stock WebSocket address according to the product type.
2. Append the token to the connection URL and establish the WebSocket connection.
3. Send a latest trade price or latest order book subscription request.
4. Send a heartbeat request every 10 seconds to keep the connection valid.
5. Receive data pushed by the server and handle automatic reconnection according to business needs.
6. 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.
# K-Line Push (Not Supported)
Source: https://alltick.co/apis/en/websocket/kline-push-not-supported
Learn K-Line Push (Not Supported) for AllTick WebSocket API, including connection setup, subscription messages, real-time quote streaming and request examples.
## K-Line Push Description
**AllTick WebSocket interfaces do not support K-line data push.** Because many customers have questions about this, this document explains that both historical K-lines and real-time K-lines are currently supported only through direct HTTP interface retrieval. The recommended implementation is as follows:
**Implementation suggestions (for reference only):**
**1. Periodically pull K-lines**: To quickly update K-lines, **it is recommended to purchase a plan with a higher request frequency to increase the pull frequency.**
**2. Use HTTP interfaces together**: We recommend using `/kline` and `/batch-kline` together as follows:
* First, use the `/kline` interface to poll historical data and store it in a local database. Later historical data can be obtained directly from the customer's database without requesting the interface again.
* Then, continuously use the `/batch-kline` interface to batch request the latest two K-lines for multiple products and update the database with the data.
This approach can quickly update the latest K-lines while avoiding request frequency restrictions caused by frequent historical K-line requests.
## Price Change Description
**AllTick interfaces do not provide a price change or 24-hour price change field.** Customers can calculate price changes themselves by obtaining AllTick data.
**1. Daily price change calculation methods**:
* **Method 1**: Use the HTTP interface to obtain today's daily K-line closing price and the previous day's daily K-line closing price. The formula is:
Price change = (today's closing price - previous day's closing price) / previous day's closing price \* 100%
* **Method 2**: Use the WebSocket interface to obtain the latest price, and use the HTTP interface to obtain today's daily K-line closing price. The formula is:
Price change = (latest price - previous day's closing price) / previous day's closing price \* 100%
**2. 24-hour price change calculation method**:
* Use the WebSocket latest trade price interface (request protocol number: 22004) to receive tick-by-tick trade prices in real time.
* You need to store the latest price from 24 hours ago pushed by the WebSocket interface for subsequent calculation.
* Formula:
24-hour price change = (latest price - latest price 24 hours ago) / latest price 24 hours ago \* 100%
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# WebSocket Interface API
Source: https://alltick.co/apis/en/websocket/stock-websocket-interface-api
Learn WebSocket Interface API for AllTick WebSocket API, including connection setup, subscription messages, real-time quote streaming and request examples.
# Latest Trade Price (Real-time Tick Data, Current Price, Latest Price) Batch Subscription
Source: https://alltick.co/apis/en/websocket/trade-subscription
Subscribe to AllTick WebSocket latest trade price streams for real-time ticks, current prices and latest prices across US stocks, Hong Kong stocks, China A-shares and major indexes.
## Interface Description
This interface supports batch subscription to the latest trade price of products (real-time tick-by-tick data, also the current price and latest price). It does not support historical trade prices (historical tick-by-tick data).
For each WebSocket connection, every time this request is sent, the backend overwrites the previous subscription request by default. For example, if you initially subscribed to products A, B, and C, and want to add E, F, and G, you need to resend A, B, C, E, F, and G together. After the subscription succeeds, data will be pushed.
Notes:
1. After a subscription succeeds once, you do not need to frequently initiate subscription requests again. You must send a heartbeat every 10 seconds, and the interface will push data in real time. If no heartbeat request is received within 30 seconds, it will be considered timed out and the requester’s WebSocket connection will be disconnected.
2. During integration, customers can add automatic reconnection logic to ensure the connection can automatically reconnect after disconnection caused by network or other reasons.
## Interface Limitations
1. Be sure to read: [WebSocket Interface Limitations](/apis/en/getting-started/websocket-interface-limitations)
2. Be sure to read: [Error Code Description](/apis/en/getting-started/error-code-description)
## API Endpoints
**1. US Stocks, Hong Kong Stocks, A Shares, and Major Index Data API Endpoint:**
* Base Path: `/quote-stock-b-ws-api`
* Full URL: `wss://quote.alltick.co/quote-stock-b-ws-api`
**2. Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities API Endpoint:**
* Base Path: `/quote-b-ws-api`
* Full URL: `wss://quote.alltick.co/quote-b-ws-api`
## Request Examples
**1. Request example for US Stocks, Hong Kong Stocks, A Shares, and Major Index Data:**
Each time a connection is established, your authentication token must be appended to the URL as follows:
`wss://quote.alltick.co/quote-stock-b-ws-api?token=your_token`
After the connection succeeds, you can subscribe to specific stock market data as needed. For detailed calling methods, refer to the documentation below.
**2. Request example for Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities:**
Each time a connection is established, your authentication token must be appended to the URL as follows:
`wss://quote.alltick.co/quote-b-ws-api?token=your_token`
After the connection succeeds, you can subscribe to specific forex, cryptocurrency, precious metals, and commodity data as needed. For detailed calling methods, refer to the documentation below.
## Request - Protocol Number: 22004
#### JSON Definition
| Field | Name | Type | Required | Description |
| - | - | - | - | - |
| cmd\_id | Protocol number | integer | Yes | The tick subscription request protocol number is fixed: 22004 |
| seq\_id | Response ID | integer | Yes | Subscription request identifier, returned in the response. Custom value; can be repeated for each request. |
| trace | Traceable ID | string | Yes | Traceable ID for request log information. Custom value; must 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 | For details, view the code list: [Click the code list](https://docs.google.com/spreadsheets/d/1avkeR1heZSj6gXIkDeBt8X3nv4EzJetw4yFuKjSDYtA/edit?gid=495387863#gid=495387863)
**Note: The code value must match the case of the code in the product list.** |
### Data Structure (JSON)
```json theme={null}
{
"cmd_id": 22004,
"seq_id": 123,
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {
"symbol_list": [
{
"code": "BTCUSDT"
},
{
"code": "ETHUSDT"
}
]
}
}
```
## Response - Protocol Number: 22005
### Data Structure (JSON)
```json theme={null}
{
"ret": 200,
"msg": "ok",
"cmd_id": 22005,
"seq_id": 123,
"trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data": {}
}
```
## Push - Protocol Number: 22998
#### Data Definition
| Field | Name | Type | Description |
| - | - | - | - |
| code | Code | string | For details, view the code list: [Click the code list](https://docs.google.com/spreadsheets/d/1avkeR1heZSj6gXIkDeBt8X3nv4EzJetw4yFuKjSDYtA/edit?gid=495387863#gid=495387863) |
| seq | Quote sequence number | integer | |
| tick\_time | Quote timestamp | integer | Unit: milliseconds |
| price | Trade price | string | Latest trade price |
| volume | Trade volume | string | Trade volume corresponding to the latest trade price |
| turnover | Turnover | string | Turnover |
| trade\_direction | Trade direction | string | Trade direction:
1. 0 is the default value, 1 is Buy, and 2 is Sell.
2. Forex, precious metals, and energy return only 1 by default.
3. Stocks and cryptocurrencies may return 0, 1, or 2 depending on market conditions.
4. Detailed description:
0: Neutral, meaning the trade was matched at a price between the best bid and best ask.
1: Aggressive buy, meaning the stock was traded at the ask price or a higher price.
2: Aggressive sell, meaning the stock was traded at the bid price or a lower price. |
### Data Structure (JSON)
```json theme={null}
{
"cmd_id": 22998,
"data": {
"code": "1288.HK",
"seq": 1782180168224,
"tick_time": 1782180164000,
"price": "651.12",
"volume": "300",
"turnover": "12345.6",
"trade_direction": 1
}
}
```
#### AllTick Website
Official website: [https://alltick.co/](https://alltick.co/)
# WebSocket Request Example
Source: https://alltick.co/apis/en/websocket/websocket-request-example
This page contains WebSocket request examples for AllTick market data APIs, including how to establish WebSocket connections, send subscription messages, handle heartbeat packets, and process realtime push data, with multi-language code samples to help developers stream forex, stock, and crypto tick and order book data efficiently.
```go Go theme={null}
package main
import (
"encoding/json"
"github.com/google/uuid"
"github.com/gorilla/websocket"
"log"
"time"
)
type Symbol struct {
Code string `json:"code"`
DepthLevel int `json:"depth_level"`
}
type Data struct {
SymbolList []Symbol `json:"symbol_list"`
}
type Request struct {
CmdID int `json:"cmd_id"`
SeqID int `json:"seq_id"`
Trace string `json:"trace"`
Data Data `json:"data"`
}
/*
Special Note:
GitHub: https://github.com/AllTick-Official/alltick-realtime-forex-crypto-stock-tick-finance-websocket-api
Token Application: https://alltick.co
Replace "testtoken" in the URL below with your own token
API addresses for forex, cryptocurrencies, and precious metals:
wss://quote.alltick.co/quote-b-ws-api
Stock API address:
wss://quote.alltick.co/quote-stock-b-ws-api
*/
const (
url = "wss://quote.alltick.co/quote-b-ws-api?token=testtoken"
)
func websocket_example() {
log.Println("Connecting to server at", url)
c, _, err := websocket.DefaultDialer.Dial(url, nil)
if err != nil {
log.Fatal("dial:", err)
}
defer c.Close()
// Send heartbeat every 10 seconds
go func() {
for range time.NewTicker(10 * time.Second).C {
req := Request{
CmdID: 22000,
SeqID: 123,
Trace: "3380a7a-3e1f-c3a5-5ee3-9e5be0ec8c241692805462",
Data: Data{},
}
messageBytes, err := json.Marshal(req)
if err != nil {
log.Println("json.Marshal error:", err)
return
}
log.Println("req data:", string(messageBytes))
err = c.WriteMessage(websocket.TextMessage, messageBytes)
if err != nil {
log.Println("write:", err)
}
}
}()
req := Request{
CmdID: 22002,
SeqID: 123,
Trace: uuid.New().String(),
Data: Data{SymbolList: []Symbol{
{"GOLD", 5},
{"AAPL.US", 5},
{"700.HK", 5},
{"USDJPY", 5},
}},
}
messageBytes, err := json.Marshal(req)
if err != nil {
log.Println("json.Marshal error:", err)
return
}
log.Println("req data:", string(messageBytes))
err = c.WriteMessage(websocket.TextMessage, messageBytes)
if err != nil {
log.Println("write:", err)
}
req.CmdID = 22004
messageBytes, err = json.Marshal(req)
if err != nil {
log.Println("json.Marshal error:", err)
return
}
log.Println("req data:", string(messageBytes))
err = c.WriteMessage(websocket.TextMessage, messageBytes)
if err != nil {
log.Println("write:", err)
}
rece_count := 0
for {
_, message, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
} else {
log.Println("Received message:", string(message))
}
rece_count++
if rece_count%10000 == 0 {
log.Println("count:", rece_count, " Received message:", string(message))
}
}
}
```
```java Java theme={null}
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.websocket.*;
// Special Note:
// GitHub: https://github.com/AllTick-Official/alltick-realtime-forex-crypto-stock-tick-finance-websocket-api
// Token Application: https://alltick.co
// Replace "testtoken" in the URL below with your own token
// API addresses for forex, cryptocurrencies, and precious metals:
// wss://quote.alltick.co/quote-b-ws-api
// Stock API address:
// wss://quote.alltick.co/quote-stock-b-ws-api
@ClientEndpoint
public class WebSocketJavaExample {
private Session session;
@OnOpen
public void onOpen(Session session) {
System.out.println("Connected to server");
this.session = session;
}
@OnMessage
public void onMessage(String message) {
System.out.println("Received message: " + message);
}
@OnClose
public void onClose(Session session, CloseReason closeReason) {
System.out.println("Disconnected from server");
}
@OnError
public void onError(Throwable throwable) {
System.err.println("Error: " + throwable.getMessage());
}
public void sendMessage(String message) throws Exception {
this.session.getBasicRemote().sendText(message);
}
public static void main(String[] args) throws Exception, URISyntaxException, DeploymentException, IOException, IllegalArgumentException, SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
// Special Note:
// GitHub: https://github.com/AllTick-Official/alltick-realtime-forex-crypto-stock-tick-finance-websocket-api
// Token Application: https://alltick.co
// Replace "testtoken" in the URL below with your own token
// API addresses for forex, cryptocurrencies, and precious metals:
// wss://quote.alltick.co/quote-b-ws-api
// Stock API address:
// wss://quote.alltick.co/quote-stock-b-ws-api
WebSocketContainer container = ContainerProvider.getWebSocketContainer();
URI uri = new URI("wss://quote.alltick.co/quote-stock-b-ws-api?token=testtoken"); // Replace with your websocket endpoint URL
WebSocketJavaExample client = new WebSocketJavaExample();
container.connectToServer(client, uri);
// Send messages to the server using the sendMessage() method
// If you want to run for a long time, in addition to sending subscriptions, you also need to modify the code to send heartbeats regularly to prevent disconnection. Refer to the interface documentation for details
client.sendMessage("{\"cmd_id\": 22002, \"seq_id\": 123,\"trace\":\"3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806\",\"data\":{\"symbol_list\":[{\"code\": \"700.HK\",\"depth_level\": 5},{\"code\": \"UNH.US\",\"depth_level\": 5}]}}");
// Wait for the client to be disconnected from the server (or until the user presses Enter)
System.in.read(); // Wait for user input before closing the program
}
}
```
```php PHP theme={null}
onWorkerStart = function()
{
// Connect to remote websocket server using the websocket protocol
$ws_connection = new AsyncTcpConnection("ws://quote.alltick.co/quote-stock-b-ws-api?token=testtoken", [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
]
]);
$ws_connection->transport = 'ssl';
// Send a websocket heartbeat opcode (0x9) to the server every 55 seconds
$ws_connection->websocketPingInterval = 10;
$ws_connection->websocketType = Ws::BINARY_TYPE_BLOB; // BINARY_TYPE_BLOB for text, BINARY_TYPE_ARRAYBUFFER for binary
// After the TCP handshake is completed
$ws_connection->onConnect = function($connection){
echo "TCP connected\n";
// Send subscription request
$connection->send('{"cmd_id":22002,"seq_id":123,"trace":"3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806","data":{"symbol_list":[{"code":"700.HK","depth_level":5},{"code":"AAPL.US","depth_level":5}]}}');
};
// After the websocket handshake is completed
$ws_connection->onWebSocketConnect = function(AsyncTcpConnection $con, $response) {
echo $response;
};
// When a message is received from the remote websocket server
$ws_connection->onMessage = function($connection, $data){
echo "Received: $data\n";
};
// When an error occurs, usually due to failure to connect to the remote websocket server
$ws_connection->onError = function($connection, $code, $msg){
echo "Error: $msg\n";
};
// When the connection to the remote websocket server is closed
$ws_connection->onClose = function($connection){
echo "Connection closed and trying to reconnect\n";
// If the connection is closed, reconnect after 1 second
$connection->reConnect(1);
};
// After setting up all the callbacks above, initiate the connection
$ws_connection->connect();
};
Worker::runAll();
?>
```
```python Pyton theme={null}
import json
import websocket # pip install websocket-client
'''
# Special Note:
# GitHub: https://github.com/AllTick-Official/alltick-realtime-forex-crypto-stock-tick-finance-websocket-api
# Token Application: https://alltick.co
# Replace "testtoken" in the URL below with your own token
# API addresses for forex, cryptocurrencies, and precious metals:
# wss://quote.alltick.co/quote-b-ws-api
# Stock API address:
# wss://quote.alltick.co/quote-stock-b-ws-api
'''
class Feed(object):
def __init__(self):
self.url = 'wss://quote.alltick.co/quote-stock-b-ws-api?token=testtoken' # Enter your websocket URL here
self.ws = None
def on_open(self, ws):
"""
Callback object which is called at opening websocket.
1 argument:
@ ws: the WebSocketApp object
"""
print('A new WebSocketApp is opened!')
# Start subscribing (an example)
sub_param = {
"cmd_id": 22002,
"seq_id": 123,
"trace":"3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data":{
"symbol_list":[
{
"code": "700.HK",
"depth_level": 5,
},
{
"code": "UNH.US",
"depth_level": 5,
}
]
}
}
# If you want to run for a long time, you need to modify the code to send heartbeats periodically to avoid disconnection, please refer to the API documentation for details
sub_str = json.dumps(sub_param)
ws.send(sub_str)
print("depth quote are subscribed!")
def on_data(self, ws, string, type, continue_flag):
"""
4 arguments.
The 1st argument is this class object.
The 2nd argument is utf-8 string which we get from the server.
The 3rd argument is data type. ABNF.OPCODE_TEXT or ABNF.OPCODE_BINARY will be came.
The 4th argument is continue flag. If 0, the data continue
"""
def on_message(self, ws, message):
"""
Callback object which is called when received data.
2 arguments:
@ ws: the WebSocketApp object
@ message: utf-8 data received from the server
"""
# Parse the received message
result = eval(message)
print(result)
def on_error(self, ws, error):
"""
Callback object which is called when got an error.
2 arguments:
@ ws: the WebSocketApp object
@ error: exception object
"""
print(error)
def on_close(self, ws, close_status_code, close_msg):
"""
Callback object which is called when the connection is closed.
2 arguments:
@ ws: the WebSocketApp object
@ close_status_code
@ close_msg
"""
print('The connection is closed!')
def start(self):
self.ws = websocket.WebSocketApp(
self.url,
on_open=self.on_open,
on_message=self.on_message,
on_data=self.on_data,
on_error=self.on_error,
on_close=self.on_close,
)
self.ws.run_forever()
if __name__ == "__main__":
feed = Feed()
feed.start()
```
***
#### AllTick Website
Official website:[https://alltick.co/](https://alltick.co/)