> ## Documentation Index
> Fetch the complete documentation index at: https://alltick.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# POST Batch Query Latest 2 K-Lines for Products (High, Low, Open, Close)

> 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.<br />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.<br />**2. Note that the /batch-kline interface requires a 10-second interval.**<br />3. All interfaces combined: maximum 10 requests per minute (one every 6 seconds).<br />4. Maximum 1,000 requests per day; usage resumes after midnight the next day if exceeded. |
| Basic                | 1. One request every 3 seconds.<br />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.<br />2. All interfaces combined: maximum 60 requests per minute (one per second).<br />**3. Note that the /batch-kline interface requires a 3-second interval.**<br />4. Maximum 86,400 requests per day; usage resumes after midnight the next day if exceeded.    |
| Premium              | 1. One request every 2 seconds.<br />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).<br />**2. Note that the /batch-kline interface requires a 2-second interval.**<br />3. Maximum 864,000 requests per day; usage resumes after midnight the next day if exceeded.                                                                   |
| Professional         | 1. One request per second.<br />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).<br />**2. Note that the /batch-kline interface requires a 1-second interval.**<br />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.<br />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).<br />**2. Note that the /batch-kline interface requires a 1-second interval.**<br />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.<br />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).<br />**2. Note that the /batch-kline interface requires a 1-second interval.**<br />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.<br />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).<br />**2. Note that the /batch-kline interface requires a 1-second interval.**<br />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](/en/getting-started/http-interface-restrictions)

2. Be sure to read: [Error Code Description](/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: <a href="https://quote.alltick.co/quote-stock-b-api/batch-kline">[https://quote.alltick.co/quote-stock-b-api/batch-kline](https://quote.alltick.co/quote-stock-b-api/batch-kline)</a>

**2. Forex, Precious Metals, Cryptocurrencies, Crude Oil, CFD Indices, and Commodities API Endpoint:**

* Base Path: `/quote-b-api/batch-kline`
* Full URL: <a href="https://quote.alltick.co/quote-b-api/batch-kline">[https://quote.alltick.co/quote-b-api/batch-kline](https://quote.alltick.co/quote-b-api/batch-kline)</a>

## 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: <a href="https://docs.google.com/spreadsheets/d/1avkeR1heZSj6gXIkDeBt8X3nv4EzJetw4yFuKjSDYtA/edit?gid=495387863#gid=495387863">\[Click the code list]</a><br />**Note: The code value must match the case of the code in the product list.**                                                                                                                                                                                                   |
| »»» kline\_type           | body     | integer   | Yes      | K-line type:<br />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.<br />2. The shortest supported K-line is 1 minute.<br />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.<br />1. Pass 0 to query K-lines backward from the latest trading day.<br />2. Pass a timestamp to query K-lines backward from that timestamp.<br />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.**<br />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:<br />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.<br />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:<br />1. During trading hours, for the latest K-line, this price is also the latest trade price.<br />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

<Note>
  Official website: <a href="https://alltick.co/">[https://alltick.co/](https://alltick.co/)</a>
</Note>

## Interface Debug

<Card title="Open POST /batch-kline Debug Module" icon="play" href="/en/api-reference/stock/debug/batch-kline">
  Use the debuggable module to fill in parameters and send requests.
</Card>

<script src="/seo-keywords.js" />
