K-line (D/W/M) API
Historical K-line data (daily / weekly / monthly). ⚠️ The turnover rate field is named `turnover` (in %) — same as /v1/quote and /v1/snapshot (renamed from `exchange` on 2026-09-26). ⚠️ The price basis is fixed at forward-adjusted (no gap on ex-dividend days; no `adjust` parameter) — do not re-adjust (double adjustment).
GET /v1/klineGET /v1/kline?code=sh600667&period=daycurl "https://api.ashareapi.com/v1/kline?code=sh600667&period=day"code * · period · count* = requiredQuick start
Replace the key below with yours (free endpoints need no key):
# 免费端点:无需 API Key(匿名即可调用)
curl "https://api.ashareapi.com/v1/kline?code=sh600667&period=day"import requests
r = requests.get(
"https://api.ashareapi.com/v1/kline",
params={"code": "sh600667"},
timeout=30,
)
print(r.json())const r = await fetch("https://api.ashareapi.com/v1/kline?code=sh600667&period=day");
console.log(await r.json());Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Stock code with market prefix: sh600667 (SH), sz000001 (SZ), hk00700 (HK), usAAPL (US) |
| period | string | No | Period: day / week / month |
| count | integer | No | Number of rows, default 30 |
codestringYesperiodstringcountintegerResponse example
Sample: `GET /v1/kline?code=sh600667&period=day&count=3` (real response, 2026-09-26, truncated). `volume` is in shares, `amount` in CNY, `turnover` is the turnover rate in %.
{
"ok": true,
"endpoint": "kline",
"tier": "free",
"elapsed_ms": 589,
"source": "multi",
"data": [
{ "date": "2026-09-24", "open": "20.17", "last": "19.41",
"high": "20.24", "low": "19.40",
"volume": "1544322", "amount": "3055480000", "turnover": "7.38" },
{ "date": "2026-09-23", "open": "20.10", "last": "20.59",
"high": "20.72", "low": "19.45",
"volume": "2591402", "amount": "5231650000", "turnover": "12.39" }
// … count bars in total, newest first — data[0] is the latest trading day
]
}Unified envelope: { ok, endpoint, tier, elapsed_ms, source, data }
Rows live in `data`; when upstream returns nothing you get `ok:false` and the call is not counted.
Free endpoints need no key (anonymous 5/min; solve one PoW challenge for 60/min). Paid tiers: Trial 30 · Standard 120 · Pro 300 · Unlimited 600 per minute; buyout packs are capped by total calls and never expire.
See the error code table →FAQ
Forward-adjusted (前复权). There is no gap on ex-dividend days — we verified 6 ex-dividend dates (COSCO Shipping Holdings 7.27%, China Shenhua 6.14%, Kweichow Moutai 2.37%, ICBC 2.31% and others) and none showed a gap. We do not offer an `adjust` parameter, nor unadjusted / backward-adjusted data.
Measured ceiling: 1212 bars (about 5 years of daily data). Larger `count` values (e.g. 2000 or 5000) still return 1212 — that is all the history the upstream holds. Default is 30.
No. `period` accepts only `day`, `week` and `month`. Minute-level data is outside our scope.
Three usual causes: ① adjustment basis — we are forward-adjusted, so against an unadjusted source the difference appears exactly on windows that span an ex-dividend date; ② a different window start date (our last bar is the latest trading day); ③ a different adjustment reference date on their side. Short windows (MA5 / MA10) normally agree; differences show up in long windows that cross an ex-dividend date (e.g. MA120).
No. `turnover` is the turnover rate in %. It was renamed from `exchange` on 2026-09-26 because the old name read like "exchange" the venue. It has the same name and value in `/v1/quote` and `/v1/snapshot`.
General (applies to every endpoint)
Free endpoints do not: health, challenge, quote, kline, hot, market-overview and changedist work anonymously. Paid endpoints do: send `Authorization: Bearer
No. When the upstream fails or returns nothing you get `ok:false` and the charge for that call is refunded (total_calls / usage_log / ep_log are rolled back together). Only calls that actually returned data count.
Quotes (quote / kline / orderbook / changedist) are real-time or current session; financials, shareholders, dividends and events are within T+1 of upstream disclosure. The `source` field in every response tells you which data channel actually served it.
No. `code` is a single-value parameter — one stock per call. For batches, issue concurrent calls and respect your tier per-minute limit.
Set up MCP once, then just ask the AI — it calls the endpoint itself. MCP exposes 24 tools covering quotes, financials, screening, sectors and macro.
Related endpoints
Upstream & downstream endpoints
Set up MCP once, then just ask the AI — it calls the endpoint itself.