A-Shares Candlestick Chart
A-Shares Candlestick Chart
Documentation
API Introduction
This API provides historical K-line data query services for China's A-share market. It supports various time periods from 1-minute to yearly K-lines and can return moving average (MA) data for specified periods as needed. The data includes core fields such as open price, close price, high price, low price, trading volume, and trading value, suitable for financial terminals, quantitative strategy backtesting, and market visualization scenarios.
Applicable Scenarios
- Market Software Development: Provide real-time and historical K-line chart data for PC or mobile applications.
- Quantitative Trading Strategies: Obtain standardized OHLCV data for technical indicator calculation and strategy backtesting.
- Financial Data Analysis: Combine with moving average data for trend analysis and market sentiment monitoring.
- Investor Education and Information Platforms: Display historical stock trends to assist investor decision-making.
Request and Response Description
Request Method: POST Core Parameters:
symbol(Required): Stock symbol, e.g.,sh688193.type(Required): K-line type, supports various granularities from1(1-minute) to86400(yearly K).limit(Optional): Number of data entries to return, default is 10.ma(Optional): Moving average periods, selectable 5, 10, 15, 20, 25, 30.
Response Results:
code: Business status code, 200 indicates success.data.list: K-line data array, includingopen(open price),close(close price),high(high price),low(low price),volume(trading volume),amount(trading value),day(time), and optionalma_priceandma_volumemoving average data.
Integration Suggestions
- Code Format Specification: Please ensure the
symbolparameter includes the market prefix (e.g., sh/sz/bj); otherwise, the query may fail. - Period Selection Optimization: For high-frequency trading scenarios, minute-level data is recommended. For long-term trend analysis, daily or weekly K-lines are recommended to reduce data volume.
- Caching Strategy: Historical K-line data changes infrequently. It is recommended to implement appropriate caching on the client or server side to reduce API call costs.
- Error Handling: Please validate the returned
codefield instead of relying solely on HTTP status codes to ensure correct business logic handling of empty data or error conditions.
Integration Examples
Includes ready-to-use Shell, Python, Go, Java, and PHP examples for direct integration.
Request Example
{
"symbol": "品种代码,如:sh688193",
"type": "k线类型, 1:1分钟,5:五分钟;15:15分钟;30:30分钟,60:60分钟,120:120分钟,240:日K,1200:周K,7200:月K,86400...",
"limit": "返回条数,默认10",
"ma": "\t返回ma均线,可选值为:5,10,15,20,25,30,可不传"
}Response Example
{
"msg": "成功",
"code": 200,
"taskNo": "202960247220113090298671",
"data": {
"list": [
{
"amount": "171325.1414",
"ma_volume5": 6110,
"ma_price5": 27.38,
"volume": "6185",
"high": "27.880",
"low": "27.600",
"day": "2024-04-22 10:05:00",
"close": "27.790",
"open": "27.600"
}
]
}
}Request Fields
The fields below are derived from example JSON for integration reference only.
| Path | Type | Sample |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.symbol | object | {...} |
| properties.symbol.type | string | string |
| properties.symbol.description | string | 品种代码,如:sh688193 |
| properties.type | object | {...} |
| properties.type.type | string |
Response Fields
The fields below are derived from example JSON for integration reference only.
| Path | Type | Sample |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.msg | object | {...} |
| properties.msg.type | string | string |
| properties.msg.example | string | 成功 |
| properties.msg.description | string | 接口返回码对应的描述信息 |
| properties.code | object | {...} |