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

Was this helpful?

  1. REST API
  2. HTTP interface API

POST Query the latest 2 K lines of products in batches(High , Low, Open, Close)

PreviousGET Single Product K line query(High Low, Open, Close)NextGET Order Book(Depth) Query

Last updated 1 month ago

Was this helpful?

English /

Post /batch-kline

Interface Description

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.

Request Frequency

Plan
Individual request
Request multiple HTTP interfaces

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.

Interface Limitations

API Endpoints

  1. 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

  2. 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 Examples

  1. 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:

    https://quote.alltick.io/quote-stock-b-api/batch-kline?token=your_token
  2. 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:

    https://quote.alltick.io/quote-b-api/batch-kline?token=your_token

Additional Notes

  • For both endpoints, the batch query parameters are expected to be provided in the request body, as the number of parameters can be extensive.

  • Ensure that the token parameter is included in the URL for authentication purposes.

Request Parameters

Name
Position
Type
Required
Description

token

query

string

No

query

query

string

No

See explanation of query request parameters below

Query Request Parameters

The following JSON should be URL-encoded and assigned to the query query string in the URL.

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

Response Example

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

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

»»» tick_time

string

false

Timestamp

»»» price

string

false

Price

»»» volume

string

false

Volume

»»» turnover

string

false

Turnover

»»» trade_direction

integer

false

Trading direction, 0 for default, 1 for BUY, 2 for SELL

Official Website

Please be sure to read:

Please be sure to read:

Official website:

[ HTTP Interface Limitations ].
[ Error Code Descriptions ].
https://alltick.co/
  • Post /batch-kline
  • Interface Description
  • Request Frequency
  • Interface Limitations
  • API Endpoints
  • Request Examples
  • Request Parameters
  • Query Request Parameters
  • Response Result
  • POST批量K线查询
  • Official Website

批量K线查询

post
Query parameters
tokenstringRequired

如果不知道你的token,请联系相关人员索要

Body
tracestringRequired

追踪码,用来查询日志使用,请保证每次请求时唯一

Responses
200
OK
application/json
post
POST /quote-stock-b-api/batch-kline HTTP/1.1
Host: quote.alltick.io
Content-Type: application/json
Accept: */*
Content-Length: 130

{
  "trace": "text",
  "data": {
    "data_list": [
      {
        "code": "text",
        "kline_type": 1,
        "kline_timestamp_end": 1,
        "query_kline_num": 1,
        "adjust_type": 1
      }
    ]
  }
}
200

OK

{
  "ret": 1,
  "msg": "text",
  "trace": "text",
  "data": {
    "kline_list": [
      {
        "code": "text",
        "kline_type": 1,
        "kline_data": [
          {
            "timestamp": "text",
            "open_price": "text",
            "close_price": "text",
            "high_price": "text",
            "low_price": "text",
            "volume": "text",
            "turnover": "text"
          }
        ]
      }
    ]
  }
}
中文