pro

批量 K 线(多只一次取)

⭐ 一次拿多只股票的 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)及以上,标准版不可用。

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

Query parameters

codesstring required

多个股票代码,逗号分隔:sh600519,sz000001,sz300750

periodstring

周期:day/week/month/season/year 或 m1~m120

countinteger

每只返回几根,默认 30

startstring

起始日期 YYYY-MM-DD(可选)

endstring

结束日期 YYYY-MM-DD(可选)

fqstring

复权:qfq 前复权 / hfq 后复权 / nofq 不复权(留空 = 服务端默认)

Response

Successful Response

unknown required

Changes

No recorded changes to this operation across all 2 revisions of this API.