Double 11 annual ¥1,699/yrView
Free endpoint · Free

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

FreeGET /v1/kline
Signature
GET /v1/kline?code=sh600667&period=day
One-liner
curl "https://api.ashareapi.com/v1/kline?code=sh600667&period=day"
Parameters: code * · period · count · start · end* = required

Quick start

Replace the key below with yours (free endpoints need no key):

curl
# 免费端点:无需 API Key(匿名即可调用)
curl "https://api.ashareapi.com/v1/kline?code=sh600667&period=day"
Python
import requests

r = requests.get(
    "https://api.ashareapi.com/v1/kline",
    params={"code": "sh600667"},
    timeout=30,
)
print(r.json())
JavaScript
const r = await fetch("https://api.ashareapi.com/v1/kline?code=sh600667&period=day");
console.log(await r.json());

Parameters

codestringYes
Stock code with market prefix: sh600667 (SH), sz000001 (SZ), hk00700 (HK), usAAPL (US)
periodstring
Period: day / week / month
countstring
Number of rows, default 30
startstring
起始日期 YYYY-MM-DD(仅 day 与分钟线;须与 end 配对;港股/美股/期货/外汇不支持)
endstring
结束日期 YYYY-MM-DD(仅 day 与分钟线;须与 start 配对;港股/美股/期货/外汇不支持)

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

Located in: dataEnvelope: ok / endpoint / tier / elapsed_ms / sourceProbed: 2026-10-20
FieldTypeReal sample value
datestr2026-10-20
openstr1321.01
laststr1331.88
highstr1335
lowstr1316.14
volumestr34136
amountstr4525398959
turnoverstr0.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
  ]
}
Response

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.

Rate limits & quota

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

Is the K-line data forward-adjusted (前复权) or raw?

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.

How many bars can I request at most?

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.

Do you support minute bars (1m / 5m / 60m)?

No. period accepts only day, week and month. Minute-level data is outside our scope.

Why do my moving averages not match another platform?

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

Is the 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)

Do these endpoints need an API key?

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.

Am I charged when the upstream returns nothing or errors?

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.

How fresh is the data?

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.

Can I request several stocks in one call?

No. code is a single-value parameter — one stock per call. For batches, issue concurrent calls and respect your tier per-minute limit.

How do I use this from Claude / Cursor / ChatGPT?

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.

Use it from an AI Agent?

Set up MCP once, then just ask the AI — it calls the endpoint itself.

← Back to the full endpoint reference