China A-Shares Ranking
China A-Shares Ranking
Documentation
API Introduction
This API provides real-time stock ranking data for China's A-share market (including Shanghai and Shenzhen Main Boards, STAR Market, ChiNext, and Beijing Stock Exchange). Developers can specify sorting fields (e.g., change rate, trading volume, turnover, turnover rate, P/E ratio, etc.) and sorting direction to obtain a list of individual stock rankings within a specific market. The data includes core market indicators such as stock code, name, real-time price, change, trading volume/turnover, and high/low/open/close prices, suitable for building financial news dashboards or quantitative screening tools.
Use Cases
- Financial News Applications: Display real-time hot sectors such as today's top gainers, top losers, and most active stocks.
- Quantitative Trading Assistance: Conduct initial stock screening based on volume ratio, turnover rate, or change over specific periods (5-day/20-day).
- Investment Analysis Tools: Provide users with sorting and query services based on fundamental metrics like market capitalization, P/E ratio, and P/B ratio.
- Market Monitoring Dashboards: Real-time monitoring of capital flows and volatility in specific markets (e.g., STAR Market or Beijing Stock Exchange only).
Request and Response Description
Request Method: POST Key Parameters:
market(Required): Specifies the market scope, options includehs_a(Shanghai and Shenzhen A-shares),kcb(STAR Market),cyb(ChiNext),hs_bjs(Beijing Stock Exchange), etc.sort(Required): Sorting basis, supporting over ten dimensions such aschangeRate(change rate),volume(trading volume),value(turnover),pe(P/E ratio),changes_5d(5-day change).asc: Sort order,0for descending (default, i.e., from largest to smallest),1for ascending.page/limit: Pagination control, maximum 100 items returned per page.
Response Results:
code: Business status code, 200 indicates success.data.list: Array of stock objects, including fields such assymbol(code),name(name),price(current price),changeRate(change rate),volume(trading volume),update_time(timestamp).
Integration Suggestions
- Caching Strategy: Market data changes frequently. It is recommended for the frontend to set a reasonable polling interval (e.g., 3-5 seconds) based on business requirements to avoid high-frequency invalid requests.
- Market Selection: Clarify the market scope required by the business. If only the main board is of interest, specify
hs_ato reduce data transfer volume and improve response speed. - Error Handling: The returned
codefield must be validated. If it's not 200, read themsginformation for error prompts; pay attention to distinguishing between HTTP status codes and business status codes.
Integration Examples
Includes ready-to-use Shell, Python, Go, Java, and PHP examples for direct integration.
Request Example
{
"sort": "排序字段,可选:changeRate 涨跌率排序,volume 成交量排序,value 成交额排序,amplitude 振幅排序, turnOver 换手率排序...",
"asc": "排序顺序,0 倒序(由大到小), 1正序(由小到大),默认0",
"page": "页码,默认1",
"limit": "每页条数,最大100条,默认10",
"market": "市场代码,可选:hs_a 沪深A股 ,hs_b 沪深B股,hs_bjs 北交所,kcb 科创板,cyb 创业板,hs 沪深所有(AB股全包含)"
}Response Example
{
"msg": "成功",
"code": 200,
"taskNo": "202960247220113090298671",
"data": {
"list": [
{
"volume": "148761581",
"symbol": "sh601138",
"high": "22.860",
"update_time": 1713324600,
"low": "21.740",
"price": "22.410",
"change": "0.6",
"name": "工业富联",
"preclose": "21.810",
"changeRate": "2.751032",
"value": "3319659472.000",
"open": "22.500"
}
]
}
}Request Fields
The fields below are derived from example JSON for integration reference only.
| Path | Type | Sample |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.sort | object | {...} |
| properties.sort.type | string | string |
| properties.sort.description | string | 排序字段,可选:changeRate 涨跌率排序,volume 成交量排序,value 成交额排序,amplitude 振幅排序, turnOver 换手率排序,volumeRatio 量比排序,pe 市盈率排序,pb 市净率排序,totalShare 总市值排序,changes_5m 五分钟涨跌幅排序, aov_5m 五分钟振幅排序,turnover_5m 五分钟换手率排序,changes_5d aov_5d turnover_5d 为五日数据,changes_20d aov_20d turnover_20d 为20日数据 |
| properties.asc | object | {...} |
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 | {...} |