> Source: https://ashareapi.com/en/docs/endpoints/kline/  ·  Markdown version for LLMs / AI agents

Free endpoint · Free

# 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).
 Free `GET /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` * = 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
 |
| | 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

 `code` string Yes
 Stock code with market prefix: sh600667 (SH), sz000001 (SZ), hk00700 (HK), usAAPL (US)

 `period` string
 Period: day / week / month

 `count` integer
 Number of rows, default 30

## 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 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 →](/en/docs/errors)

## 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 `. ⚠️ 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 **60/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 upstream disclosure**. The `source` field in every response tells you which data channel actually served it.

 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 24 tools covering quotes, financials, screening, sectors and macro.

## Related endpoints
 [Health check](/en/docs/endpoints/health)[获取 PoW 挑战（匿名提额用）](/en/docs/endpoints/challenge)[Real-time quote](/en/docs/endpoints/quote)[Hot list](/en/docs/endpoints/hot)[Market overview](/en/docs/endpoints/market-overview)[Up/down distribution](/en/docs/endpoints/changedist)

### Upstream & downstream endpoints
 [Technical indicators](/en/docs/endpoints/technical)[Dividends & splits](/en/docs/endpoints/dividend)[全字段行情画像（估值/市值/股本/涨停价）](/en/docs/endpoints/snapshot)

### Tutorials
 [Getting A-share quotes with Python: three approaches →](/en/docs/guides/python-ashare-quotes)

 Use it from an AI Agent?
 Set up MCP once, then just ask the AI — it calls the endpoint itself.

 [MCP setup](/en/mcp)[Pricing](/en/pricing)

 [← Back to the full endpoint reference](/en/endpoints)
