Migrating from Eastmoney to ashareapi
Eastmoney push2 and this API do not share a parameter scheme, but the data comes from the same upstream. Below: the mapping table, the field mapping, runnable before/after code, and the six places where the two necessarily differ — read those six first and you skip most of the debugging.
K-line and snapshots line up; three changes get you running (code format, period parameter, f53 maps to last). Change %, change amount and amplitude are derived values — we do not return them and do not compute them; use the ChangePCT factor in /v1/screen to filter by change. There is no equivalent of clist (whole-market realtime list): use /v1/market-kline after the close, /v1/quote-batch intraday, and /v1/screen for conditional scans.
What moves / what does not
- Daily / weekly / monthly / quarterly / yearly klines, plus m1 to m120 minute bars
- Single-symbol snapshot (price / open-high-low / volume-amount / turnover)
- Batch quotes (
ulist.npto/v1/quote-batch, 200 symbols per call) - Batch klines (
/v1/kline-batch, 200 symbols x N bars per call) - Whole-market bars for one day (
clistafter-close use case to/v1/market-kline) - Conditional screening / ranking / labels / events (
clistplus local filtering to/v1/screen) - Free endpoints need no key at all today
- Whole-market realtime list: we are driven by a symbol list or a date, not by "whole market x arbitrary fields x server-side sort"
- Derived values: change % (f59), change amount (f60), amplitude (f58) — computed fields, not returned
- Historical order book: five levels are current only, no replay
- Tick-by-tick trades: only available in the L2 large-order dimension, not full tape
- Eastmoney sector codes:
90.BK0475and ourpt01801081are different schemes and do not convert
Three changes
Eastmoney uses "market.code" (1.600519); we use "market prefix + code" (sh600519). Note that Beijing Stock Exchange also reports market 0 on Eastmoney, so you cannot map 0 to Shenzhen blindly — check the code range, or 0.920047 becomes sz920047 and returns nothing.
# Eastmoney secid -> our code
# 1.600519 -> sh600519
# 0.000001 -> sz000001
# 0.920047 -> bj920047 <- market 0, but not Shenzhen
def secid_to_code(secid: str) -> str:
mkt, num = secid.split(".")
num = num.zfill(6)
if num[:2] == "92" or num[0] in ("4", "8"):
return "bj" + num
return ("sh" if mkt == "1" else "sz") + numPeriod klt becomes period; bar count lmt becomes count; date range beg / end (YYYYMMDD) becomes start / end (YYYY-MM-DD). Adjustment fqt has no counterpart on the free endpoint — see the next section.
# Eastmoney
# push2his.eastmoney.com/api/qt/stock/kline/get
# ?secid=1.600519&klt=101&fqt=1&lmt=30
# Us
curl "https://api.ashareapi.com/v1/kline?code=sh600519&period=day&count=30"
# klt 101/102/103 -> day/week/month
# klt 1/5/15/30/60 -> m1/m5/m15/m30/m60Of the 11 columns in Eastmoney fields2, eight line up. Only the close price is named differently: f53 is last here, not close. The remaining three (amplitude / change % / change amount) are not returned.
{
"ok": true, "endpoint": "kline", "tier": "free",
"data": [
{"date": "2026-11-06", "open": "1450", "last": "1453",
"high": "1457.72", "low": "1436",
"volume": "42848", // lots, same unit as f56
"amount": "6199530000", // CNY, rounded to 10k
"turnover": "0.34"} // %, maps to f61
]
}Parameter mapping
Left is the Eastmoney push2 form, right is the equivalent call. Eastmoney parameters not listed here (ut / fltt / invt / fields1) are internal format switches we do not need.
| Purpose | Eastmoney push2 | Ours |
|---|---|---|
| Symbol | secid=1.600519 | code=sh600519 (bare 600519 also accepted) |
| Period | klt=101 / 102 / 103 / 1 / 5 / 15 / 30 / 60 | period=day / week / month / m1 / m5 / m15 / m30 / m60 |
| Adjustment | fqt=0 raw / 1 forward / 2 backward | free kline is always forward-adjusted, no fq parameter; for raw or backward use /v1/kline-full or /v1/kline-batch |
| Bar count | lmt=30 | count=30 (max 1212) |
| Date range | beg=20260101&end=20261106 (YYYYMMDD) | start=2026-01-01&end=2026-11-06 (YYYY-MM-DD, must be paired) |
| Field selection | fields2=f51,f52,... (pick columns) | fixed 8 columns, cannot pick |
| Single snapshot | stock/get?secid=1.600519 | quote?code=sh600519 |
| Batch | ulist.np/get?secids=1.600519,0.000001 | quote-batch?codes=sh600519,sz000001 |
| Whole-market list | clist/get?fs=m:1+t:2&fields=...&fid=f3&po=1 | no equivalent — see the scanning section |
| Sort / paging | fid=sort field & po=0/1 & pn / pz | screen orderby / desc / limit / offset |
Kline field mapping (11 columns to 8)
Column-by-column mapping of Eastmoney fields2=f51,...,f61. Measured on 600519 for 2026-11-06: open 1450 / close 1453 / high 1457.72 / low 1436 / volume 42848 lots / amount 6199528289 CNY / amplitude 1.50% / change 0.07% / change amount 1.00 / turnover 0.34%.
| Eastmoney | Ours | Notes |
|---|---|---|
| f51 date | date | Same format (YYYY-MM-DD) |
| f52 open | open | Same |
| f53 close | last | Different name — the only mandatory rename |
| f54 high | high | Same |
| f55 low | low | Same |
| f56 volume | volume | Same, both in lots (1 lot = 100 shares) |
| f57 amount | amount | Both in CNY, but ours is rounded to 10k (tail differs by up to 5000 CNY) |
| f58 amplitude | - | Not returned (derived) |
| f59 change % | - | Not returned (derived) |
| f60 change amount | - | Not returned (derived) |
| f61 turnover | turnover | Same, in % |
Six places where the data necessarily differs
These are structural, not faults. Read them once so you do not mistake them for bad data.
Ours is rounded to 10k (600519 on 2026-11-06 returns 6199530000); Eastmoney is exact to the yuan (6199528289). Magnitude and ordering are unaffected.
/v1/kline and /v1/kline-batch are in lots (same as f56); /v1/market-kline and /v1/kline-full are in shares. Comparing across them gives a 100x gap.
Free /v1/kline is always forward-adjusted (minute bars are always raw), and passing fq is rejected rather than silently ignored. Eastmoney forward-adjusted history can go negative (600519 around -312 in 2001); ours does not — long histories are not directly comparable.
Change %, change amount and amplitude are not returned and not computed for you. Dividing two adjacent closes yourself breaks as soon as you change period.
m1 / m5 bars land in batches upstream; the latest bar usually trails by 1 to 13 minutes. Comparing bar by bar against a realtime feed will mismatch at the tail.
/v1/quote returns a daily series: data[0] is latest, data[1] is the previous session. For "previous close" take data[1].last; do not back out price minus change.
Replacing whole-market scans
If your scan was "pull clist for the whole market, filter locally", it splits into three routes here. None of them needs 5000 paged calls.
| Your case | Use this | Notes |
|---|---|---|
| Whole-market bars after the close | /v1/market-kline?date=2026-11-06 | One call returns 5000+ symbols with code / time / open / high / low / close / volume / amount (raw prices, volume in shares) |
| Intraday, you have a symbol list | /v1/quote-batch?codes=... | 200 symbols per call, per-symbol success flags; 5000 symbols is 25 calls |
| Conditional filter (you do not need all) | /v1/screen?mode=condition&expr=...&limit=9999 | One expression returns every match market-wide; supports ChangePCT / TurnoverRate / MainNetFlow and more; limit has no 200 cap |
| Ranking / labels / strategies / events | /v1/screen?mode=ranking / label / strategy / event | Add list=true to enumerate every available value instead of guessing |
Before and after
Left is the Eastmoney push2 call, right is the equivalent. Note close to last.
import requests
url = "https://push2his.eastmoney.com/api/qt/stock/kline/get"
params = {
"secid": "1.600519", # 1=Shanghai 0=Shenzhen
"klt": 101, # 101=daily
"fqt": 1, # 1=forward adjusted
"beg": 0,
"end": 20500101,
"lmt": 30,
"fields1": "f1,f2,f3,f4,f5,f6",
"fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
}
r = requests.get(url, params=params).json()
for line in r["data"]["klines"]:
date, o, c, h, l, vol, amt, amp, pct, chg, tor = line.split(",")
print(date, c, vol)import requests
r = requests.get(
"https://api.ashareapi.com/v1/kline",
params={"code": "sh600519", "period": "day", "count": 30},
timeout=30,
).json()
for bar in r["data"]:
print(bar["date"], bar["last"], bar["volume"]) # close -> last
# no amp / pct / chg columns: filter with the ChangePCT factor in /v1/screen
# instead of deriving them locally (which breaks when you change period)FAQ
No — the schemes differ (secid / klt / fqt / fields are push2-specific). The mapping is fixed though: apply the three changes above, or wrap them in one adapter function and keep passing Eastmoney parameters at the call site.
Change % is derived, so we return raw values only. Filter with /v1/screen?mode=condition&expr=intersect([ChangePCT > 5]), which returns every match market-wide in one call.
See the six structural differences. The usual suspects are amount rounded to 10k, lots versus shares across endpoints, and minute-bar tail lag.
Automatic multi-source failover: if one source fails we move to the next, and the failed attempt is not counted against your quota. The source field tells you which channel served the request.
Free /v1/kline is always forward-adjusted. For nofq / hfq use /v1/kline-full?fq=nofq (Standard and above, A-shares only) or /v1/kline-batch?fq=nofq (Pro and above, batch).
The schemes are unrelated: Eastmoney uses 90.BK0475, we use pt01801081. Resolve by sector name with /v1/sector or /v1/search.
Last updated: 2026-11-08
Eastmoney parameters and fields come from live push2 responses (600519 measured on 2026-11-08, columns verified: f58 amplitude 1.50%, f59 change 0.07%, f60 change amount 1.00, f61 turnover 0.34%). Our fields come from live responses for the same symbol and date, compared column by column. Both sides may change; their official pages govern.
Free endpoints need no key — klines and quotes work right away. Move your scripts once it returns data.