Wiki
Reference material: field references, convention notes and common misuses. Shorter than the tutorials — look things up as needed.
A K-line row has 8 fields — date, open, last, high, low, volume, amount, turnover — and they do not change with the period. Two things trip people up most: the close price field is named last, not close; and every numeric value is a string, not a number.
ViewThe same field name can carry different units on different endpoints: volume is always lots, but amount is CNY on K-line and CNY-10k on snapshot. Mixing them up throws the value off by 100x to 10,000x.
ViewDay / week / month / quarter / year bars are always forward-adjusted, so they do not gap on ex-dividend dates and moving averages are not fooled by the hole. Minute bars are unadjusted — they carry the raw price. There is no adjust parameter, and you should not adjust them yourself.
ViewEvery endpoint wraps its result in the same six outer fields, and the payload itself lives in data, which comes in more than one shape. Some errors (missing parameter, over the limit, a paid endpoint without a key) use a different structure — do not parse those as the envelope.
ViewA code is always written as market prefix plus code, and the prefix must be lowercase. A-shares use sh/sz/bj, Hong Kong hk, US us; ETFs, convertible bonds and sectors each have their own number ranges. A bare code without a prefix comes back empty on the quote endpoints.
ViewTo judge how fresh the data is, read the date field in the response, not your system clock. Each market has its own latest trading day, and endpoints refresh at different cadences — from about 10 seconds to once per trading day after the close.
ViewAn empty array usually means there was no data for this request, not that the API is broken — a malformed code, a market holiday, or data that has not been disclosed yet all look like this. Empty results do not consume quota; work through the list below first.
ViewThe payload in data comes in four different shapes — row arrays, table lists, pre-rendered text and multi-segment structures. Check the type before reading it, or you will index into a string where you should read a field, or the reverse.
ViewOn the quote, indicator and financial endpoints the numbers arrive as strings ("1723.50") rather than numbers. Doing arithmetic, comparisons or sorting on them directly goes wrong — check the type before converting.
ViewOnly some endpoints accept several codes at once, and each one stitches the result back differently — one adds a symbol column, one folds the code into the column names. Check which kind it is before you send a list.
ViewQuote fields are identical across markets, but company profile, dividend and share-structure fields differ, and some endpoints only cover A-shares. Check this table before writing cross-market code.
View