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

# Single-product K-lines

### 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                                                                                                                                |
