POST Query the latest 2 K lines of products in batches(High , Low, Open, Close)
Last updated
Was this helpful?
Last updated
Was this helpful?
English /
This interface allows batch querying of multiple products and multiple K-line types (e.g., 1-minute, 15-minute, 30-minute), but only the latest two K-lines can be queried at once.
For clients using the HTTP interface to obtain K-lines, it is advisable to combine the /kline
and /batch-kline
interfaces as follows:
First, use the /kline
interface to poll for historical data and store it in a local database. Subsequent historical data can be retrieved directly from the client's database without needing to make additional requests through the interface.
Then, continuously use the /batch-kline
interface to request the latest two K-lines for multiple products in bulk and update the database with this data.
This method allows for quick updates of the latest K-lines while avoiding limitations on request frequency caused by frequent requests for historical K-lines.
Free
1、1 request allowed every 10 seconds.
2、Each query can batch retrieve 10 items, where 10 equals the product count times the candlestick type.
1、One request per second.
2、/batch-kline needs 10-second intervals.
3、Total of 10 requests per minute (every 6 seconds).
4、Max 14400 daily requests; excess resets at midnight.
Basic
1、1 request every 3 seconds.
2、Each query can batch retrieve 100 items, where 100 equals the product count times the candlestick type.
1、One request per second.
2、/batch-kline: 1 request every 3 seconds.
3、Total of 60 requests per minute (1 request per second).
4、Max 86400 daily requests; excess resets at midnight.
Premium
1、1 request every 2 seconds.
2、Each query can batch retrieve 200 items, where 200 equals the product count times the candlestick type.
1、Combined interfaces: 10 requests/second.
2、/batch-kline: 1 request/2 seconds.
3、Total: 600 requests/minute (10/second).
4、Daily limit: 864,000 requests; reset daily at midnight if exceeded.
Professional
1、1 request per second.
2、Each query can batch retrieve 500 items, where 500 equals the product count times the candlestick type.
1、Combined interfaces: 20 requests/second.
2、/batch-kline: 1 request/second interval.
3、Total: 1200 requests/minute (20/second).
4、Daily limit: 1,728,000 requests; reset daily at midnight if exceeded.
All HK Stocks
1、1 request per second.
2、Each query can batch retrieve 500 items, where 500 equals the product count times the candlestick type.
1、Combined interfaces: 20 requests/second.
2、/batch-kline: 1 request/second interval.
3、Total: 1200 requests/minute (20/second).
4、Daily limit: 1,728,000 requests; reset daily at midnight if exceeded.
All CN Stocks
1、1 request per second.
2、Each query can batch retrieve 500 items, where 500 equals the product count times the candlestick type.
1、Combined interfaces: 20 requests/second.
2、/batch-kline: 1 request/second interval.
3、Total: 1200 requests/minute (20/second).
4、Daily limit: 1,728,000 requests; reset daily at midnight if exceeded.
US Stocks, Hong Kong Stocks, A Shares, Major Index Data API Endpoints:
Base Path: /quote-stock-b-api/batch-kline
Full URL: https://quote.alltick.io/quote-stock-b-api/batch-kline
Forex, Precious Metals, Cryptocurrencies, Commodities API Endpoints:
Base Path: /quote-b-api/batch-kline
Full URL: https://quote.alltick.io/quote-b-api/batch-kline
Request Example for US Stocks, Hong Kong Stocks, A Shares, Major Index Data:
The batch query function for retrieving the latest K-line data requires many parameters, which should be included in the request body. Only the token
parameter should be included in the URL.
When sending the query request, you must include the method name and token information. An example request is as follows:
Request Example for Forex, Precious Metals, Cryptocurrencies, Commodities:
The batch query function for retrieving the latest K-line data requires many parameters, which should be included in the request body. Only the token
parameter should be included in the URL.
When sending the query request, you must include the method name and token information. An example request is as follows:
token
parameter is kept in the URL.token
query
string
Yes
body
body
object
No
» trace
body
string
Yes
Trace code used for logging purposes, ensure uniqueness for each request
» data
body
object
Yes
»» data_list
body
[object]
Yes
»»» code
body
string
Yes
»»» kline_type
body
integer
Yes
Type of K-line: 1、1 represents 1-minute K-line, 2 represents 5-minute K-line, 3 represents 15-minute K-line, 4 represents 30-minute K-line, 5 represents 1-hour K-line, 6 represents 2-hour K-line (not supported for stocks), 7 represents 4-hour K-line (not supported for stocks), 8 represents daily K-line, 9 represents weekly K-line, and 10 represents monthly K-line. (Note: Stocks do not support 2-hour and 4-hour K-lines.) 2、The shortest K-line supported is 1 minute. 3、Query yesterday's closing price, with kline_type set to 8.
»»» kline_timestamp_end
body
integer
Yes
Query K-lines from a specified time:
1、Send 0 to query from the latest trading day.
2、Send a timestamp to query from that time.
3、Only forex, precious metals, and cryptocurrencies support timestamps; stock codes do not.
»»» query_kline_num
body
integer
Yes
1、Number of K-lines to query, maximum of 1000 2、To query yesterday's closing price, set kline_type to 8 and query_kline_num to 2. From the 2 returned k-line data points, the one with the smaller timestamp represents yesterday's closing price.
»»» adjust_type
body
integer
Yes
Adjustment type, effective only for stock codes, e.g., 0: ex-rights, 1: pre-adjustment, currently only supports 0
200
OK
OK
Inline
» ret
integer
true
Return code
» msg
string
true
Message corresponding to the return code
» trace
string
true
Request trace
» data
object
true
»» kline_list
[object]
true
»»» code
string
false
Code
»»» kline_type
integer
integer
Kline Types:
1= 1-minute,2 = 5-minute,3 = 15-minute, 4 = 30-minute, 5 = 1-hour, 6 = 2-hour (not supported for stocks), 7 = 4-hour (not supported for stocks), 8 = daily, 9 = weekly, 10 = monthly(Note: 2-hour and 4-hour Klines are not supported for stocks)
The shortest supported Kline is 1-minute.
»»» kline_data
[array]
true
»»» timestamp
string
true
Timestamp of the Kline
»»» open_price
string
false
Open price of the Kline
»»» close_price
string
true
Close price of the Kline:
During trading hours, for the latest Kline, this is also the last traded price
During market closure, for the latest Kline, this is the official closing price
»»» high_price
integer
true
High price of the Kline
»»» low_price
integer
true
Low price of the Kline
»»» volume
string
true
Trade volume of the Kline
»»» turnover
string
true
Trade amount (turnover) of the Kline
Please be sure to read:
Please be sure to read:
Refer to the code list and select the code you want to query:
Official website: