K-line (D/W/M) API
Historical K-line data (daily / weekly / monthly / quarterly / yearly, plus minute bars m1–m120). ⚠️ Any date span on daily bars: start/end can cover 3 years, 5 years or the full history since listing — one call returns the complete series, no need to split by year and stitch. ⚠️ 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). ⚠️ Minute bars require the Standard tier (¥29.9) and above; daily / weekly / monthly / quarterly / yearly are free. ⚠️ Free / anonymous tiers refresh on a 5-minute cycle; paid tiers are real-time (every call returns the latest value). ⚠️ volume is in LOTS (1 lot = 100 shares) — 100× smaller than /v1/kline-full and /v1/market-kline, which report shares; amount is in CNY. ⚠️ code accepts a comma-separated list (multiple symbols) — but anonymous calls are capped at 5 symbols per request (no cap with an API key).
GET /v1/klineGET /v1/kline?code=sh600667&period=daycurl "https://api.ashareapi.com/v1/kline?code=sh600667&period=day"code * · period · count · start · end* = 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 | string | No | Number of rows, default 30 |
| start | string | No | 起始日期 YYYY-MM-DD(仅 day 与分钟线;须与 end 配对;港股/美股/期货/外汇不支持) |
| end | string | No | 结束日期 YYYY-MM-DD(仅 day 与分钟线;须与 start 配对;港股/美股/期货/外汇不支持) |
codestringYesperiodstringcountstringstartstringendstringResponse fields
The table below is captured from real API calls (not inferred): each row gives the field name, its type and one real sample value, so you can align your parser.
dataEnvelope: ok / endpoint / tier / elapsed_ms / sourceProbed: 2026-10-20| Field | Type | Real sample value |
|---|---|---|
| date | str | 2026-10-20 |
| open | str | 1321.01 |
| last | str | 1331.88 |
| high | str | 1335 |
| low | str | 1316.14 |
| volume | str | 34136 |
| amount | str | 4525398959 |
| turnover | str | 0.27 |
Response 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 — 250 bars per request, 100k rows per day; solve one PoW challenge for 15/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. ⚠️ Anonymous (key-less) calls are capped at 250 bars per request; use an API key to get the full 1212.
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).
turnover field the "exchange"?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 <your key>. ⚠️ The anonymous allowance is tiered by caller type: browsers (humans) get 5/min; scripts, SDKs and AI Agents (curl, requests, axios, openai user-agent strings) get 2/min — automated traffic is easier to abuse. Solving one PoW challenge (GET /v1/challenge, then send the X-PoW header) raises it to 15/min regardless of type. ⚠️ Also, anonymous calls are capped at 250 bars per request and 100k rows per day — use an API key for the full 1212 bars or unlimited daily volume.
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 source disclosure. Every response carries its own data timestamp — time (HHMM) on intraday bars, date (trading day) on quotes — so you can check exactly which moment a payload reflects.
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 92 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.