---
title: "批量 K 线（多只一次取）"
method: GET
path: "/v1/kline-batch"
tags: ["pro"]
---

# 批量 K 线（多只一次取）

`GET /v1/kline-batch`

## Request

- Base URL: `https://api.ashareapi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.ashareapi.com/v1/kline-batch`
- Auth: none declared

⭐ **一次拿多只股票的 K 线**（多只 × 同一段时间），**逐只标明成功与否** —— 给量化/批量研究用。

**它解决什么**：自己循环取 200 只 × 30 天 = 200 次请求 ≈ **2.3 分钟**（还会撞限频退避）；本端点实测 **3.39 秒**拿完（6,000 行，200 只全部返回）。

**与其它三个 K 线端点的分工（务必看清）**：
| 端点 | 取什么 |
|---|---|
| `/v1/kline` | 一只（`code` 虽接受逗号，但返回扁平行、缺了哪只算不出来）|
| `/v1/kline-full` | **一只 × 全部历史**（约 2465 根）|
| `/v1/market-kline` | **某一天 × 全市场**（按日期驱动）|
| **本端点** | **多只 × 同一段时间**（按代码列表驱动）|

**用法**：`codes` 逗号分隔，如 `?codes=sh600519,sz000001,sz300750`；支持裸 6 位码与带前缀。

**返回**：`data` 是数组，每项 `{code, ok, data:[...]}`（或 `error`）—— **取几只就回几个条目**，`data` 内是该只的 K 线数组；同时给 `requested` / `returned` / `failed` 计数。

**上限**：专业版单次最多 **200** 只，不限量版 **1000** 只；另受**总条数 6 万**约束（标的数 × `count` ≤ 60,000，如 200 只 × 300 根触顶）。**计费按实际返回只数**（失败的不计）。

⚠️ `period` 默认 `day`；`count` 默认 **30**（每只各 30 根，与 `/v1/kline` 一致）。⚠️ 换手率字段名是 **`turnover`**（%，与 `/v1/kline` 同名同值）；返回字段固定 8 列（`symbol` `date` `open` `last` `high` `low` `volume` `amount` `turnover`）。

⚠️ **付费端点**：**专业版（¥99）及以上**，标准版不可用。

## Query parameters

- `codes` string, required: 多个股票代码，逗号分隔：sh600519,sz000001,sz300750
- `period` string: 周期：day/week/month/season/year 或 m1~m120
- `count` integer: 每只返回几根，默认 30
- `start` string: 起始日期 YYYY-MM-DD（可选）
- `end` string: 结束日期 YYYY-MM-DD（可选）
- `fq` string: 复权：qfq 前复权 / hfq 后复权 / nofq 不复权（留空 = 服务端默认）

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/ashareapi/apis/a-api.md) · [All operations](https://skmtc.dev/ashareapi/apis/a-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ashareapi/apis/a-api/revisions/fc57bdcb13d5?raw)
