GET Single Product K line query(High Low, Open, Close)
Last updated
Was this helpful?
Last updated
Was this helpful?
English /
This interface can be used to query historical K-line data, but it only allows querying one product at a time. It is recommended to cache the retrieved historical K-lines in a local database.
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
Once every 10 seconds, only 1 request can be made
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
Only 1 request per second
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
Up to 10 requests per second
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
Up to 20 requests per second
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
Up to 20 requests per second
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
Up to 20 requests per second
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/kline
Full URL: https://quote.alltick.io/quote-stock-b-api/kline
Forex, Precious Metals, Cryptocurrencies, Commodities API Endpoints:
Base Path: /quote-b-api/kline
Full URL: https://quote.alltick.io/quote-b-api/kline
Request Example for US Stocks, Hong Kong Stocks, A Shares, Major Index Data:
When sending a query request, you must include the method name and token information. An example request is as follows:
https://quote.alltick.io/quote-stock-b-api/kline?token=your_token&query=queryData
Request Example for Forex, Precious Metals, Cryptocurrencies, Commodities:
When sending a query request, you must include the method name and token information. An example request is as follows:
https://quote.alltick.io/quote-b-api/kline?token=your_token&query=queryData
token
query
string
No
query
query
string
No
See explanation for query request parameter below
Explanation for query request parameter
Encode the following JSON using URL encoding and assign it to the 'query' query string in the URL:
trace
string
Yes
Trace code used for logging purposes, ensure uniqueness for each request
data
object
Yes
» code
string
Yes
» kline_type
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
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
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
integer
Yes
Adjustment type, effective only for stock codes, e.g., 0: ex-rights, 1: pre-adjustment, currently only supports 0
Response Example OK
200
OK
OK
Inline
» ret
integer
true
» msg
string
true
» trace
string
true
» data
object
true
»» code
string
true
Code
»» kline_type
integer
true
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.
»» 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
»»» high_price
string
true
Highest price of the K-line
»»» low_price
string
true
Lowest price of the K-line
»»» volume
string
true
Trading volume of the K-line
»»» turnover
string
true
Trading turnover of the K-line
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:
如果不知道你的token,请联系相关人员索要
65b31e26-312c-4e71-89ae-f5e33073d1c8-1676446387481
请对如下字段进行encode,后台服务收到之后会decode { "trace": "culpa cillum ea reprehenderit occaecat", "data": { "code": "GBPJPY", "kline_type": 1, "kline_timestamp_end": 0, "query_kline_num": 2, "adjust_type": 0 } } trace:追踪码,用来查询日志使用,请保证每次请求时唯一 code:请查看code列表,选择你要查询的code kline_type:k线类型,1分钟K,2为5分钟K,3为15分钟K,4为30分钟K,5为小时K,6为2小时K,7为4小时K,8为日K,9为周K,10为月K kline_timestamp_end:从那个时间点往前查,为0表示从当前时间,非股票类的code才有效 query_kline_num:查询多少根K线,最多1000根 adjust_type: 复权类型,对于股票类的code才有效,例如:0:除权,1:前复权
%7B%20%20%20%20%22trace%22%3A%20%22culpa%20cillum%20ea%20reprehenderit%20occaecat%22%2C%20%20%20%20%22data%22%3A%20%7B%20%20%20%20%20%20%20%20%22code%22%3A%20%22BTCUSDT%22%2C%20%20%20%20%20%20%20%20%22kline_type%22%3A%201%2C%20%20%20%20%20%20%20%20%22kline_timestamp_end%22%3A%200%2C%20%20%20%20%20%20%20%20%22query_kline_num%22%3A%202%20%20%20%20%7D%7D
OK