指数专题
指数历史行情
查询指数历史行情数据
接口基本信息
- 接口名称:
get_index_history_quotation - 功能描述: 查询指数历史行情数据
- 数据更新频率: 日频
- 请求方法:
POST - API 路径:
https://api.wanxingai.com/openapi/get_index_history_quotation/
输入参数说明
| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
|---|---|---|---|---|---|
index_code |
str | 是 | — | 指数代码,需含交易所后缀 | 000001.SH |
datestr |
str | 否 | 今天 | 查询日期,格式 YYYY-MM-DD,不传则默认今天 | 2026-04-01 |
返回数据说明
| 字段名 | 类型 | 描述 |
|---|---|---|
code |
str | 指数代码 |
data |
array | 指标数组,每项包含 indicator / description / value |
pre_close_index |
float | 前收盘价 |
open_price_index |
float | 开盘价 |
high_price_index |
float | 最高价 |
low_index |
float | 最低价 |
close_price_index |
float | 收盘价 |
chg_ratio_index |
float | 涨跌幅(%) |
chg_index |
float | 涨跌额 |
vol_index |
float | 成交量 |
trans_amt_index |
float | 成交额 |
turnover_ratio_index |
float | 换手率(%) |
swing_index |
float | 振幅(%) |
使用示例
import requests
url = "https://api.wanxingai.com/openapi/get_index_history_quotation/"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer sk-********"
}
payload = {"index_code": "000001.SH", "datestr": "2026-04-01"}
resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
import java.net.http.*;
import java.net.URI;
HttpClient client = HttpClient.newHttpClient();
String json = """
{"index_code": "000001.SH", "datestr": "2026-04-01"}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.wanxingai.com/openapi/get_index_history_quotation/"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer sk-********")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
curl -X POST https://api.wanxingai.com/openapi/get_index_history_quotation/ \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer sk-********" \\
-d '{"index_code": "000001.SH", "datestr": "2026-04-01"}'
注意事项
- datestr 不传则默认使用今天日期
- 指数代码需含交易所后缀,如 000001.SH(上证指数)、399001.SZ(深证成指)