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

# 多单产品k线

### 接口说明

该接口可以一次性批量查询多个产品，且可批量一次性查询多个k线类型（k线类型指的是1分钟、15分钟、30分钟等），但只能批量查询最新的2根k线。

```http theme={null}
POST /v1/batch-kline
```

| 产品类型                    | 请求地址                                                        |
| ----------------------- | ----------------------------------------------------------- |
| 美股、港股、A股、大盘数据           | `https://quote.alltick.co/quote-stock-b-api/v1/batch-kline` |
| 外汇、贵金属、加密货币、原油、CFD指数、商品 | `https://quote.alltick.co/quote-b-api/v1/batch-kline`       |

### 请求参数

| 参数          | 类型     | 必填 | 说明     |
| ----------- | ------ | -- | ------ |
| `X-API-Key` | string | 是  | 身份认证令牌 |
| `body`      | string | 是  | 请求内容   |

### body 请求内容

```json theme={null}
{
  "trace": "c2a8a146-a647-4d6f-ac07-8c4805bf0b74",
  "data": {
    "symbol_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
      }
    ]
  }
}
```

| 名称                    | 类型      | 必选 | 说明                      |
| --------------------- | ------- | -- | ----------------------- |
| `trace`               | string  | 是  | 追踪码，用来查询日志使用，请保证每次请求时唯一 |
| `data`                | object  | 是  | 请求数据                    |
| `symbol_list`         | array   | 是  | 产品及K线条件列表               |
| `code`                | string  | 是  | 产品代码，大小写要与产品列表一致        |
| `kline_type`          | integer | 是  | K线类型，1至10分别代表1分钟K至月K    |
| `kline_timestamp_end` | integer | 是  | 0表示从当前最新交易日往前查询         |
| `query_kline_num`     | integer | 是  | 该接口最大只能查询2根K线           |
| `adjust_type`         | integer | 是  | 股票复权类型，目前仅支持0           |

### 返回示例

```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"}]
      }
    ]
  }
}
```

### 返回字段

返回 `ret`、`msg`、`trace` 和 `data.kline_list`。每项包含 `code`、`kline_type` 和 `kline_data`；K线数据包含 `timestamp`、`open_price`、`close_price`、`high_price`、`low_price`、`volume`、`turnover`。
