行情数据
股票实时行情
获取股票实时行情数据
接口基本信息
- 接口名称:
get_stock_real_time_quotation - 功能描述: 获取 A 股股票实时行情数据
- 数据更新频率: 实时
- 请求方法:
POST - API 路径:
https://api.wanxingai.com/openapi/real_time_quotation/
输入参数说明
| 参数名 | 类型 | 必选 | 描述 | 示例 |
|---|---|---|---|---|
stock_code |
str | 是 | 完整股票代码 | 600519.SH |
indicators |
str | 是 | 指标列表 | preClose,open,high,latest |
返回数据说明
| 字段 | 类型 | 说明 |
|---|---|---|
| code | string | 股票代码 |
| time | string[] | 行情时间 |
| table | object | 行情数据表 |
| table.preClose | float[] | 前收盘价 |
| table.open | float[] | 开盘价 |
| table.high | float[] | 最高价 |
| table.low | float[] | 最低价 |
| table.latest | float[] | 最新价/收盘价 |
| table.amount | float[] | 成交额(元) |
| table.volume | float[] | 成交量(手) |
| table.changeRatio | float[] | 涨跌幅(%) |
| table.turnoverRatio | float[] | 换手率(%) |
使用示例
import requests
url = "https://api.wanxingai.com/openapi/real_time_quotation/"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer sk-********"
}
payload = {
"stock_code": "600519.SH",
"indicators": "preClose,open,high,low,latest,amount,volume,changeRatio"
}
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 = """
{"stock_code": "600519.SH", "indicators": "preClose,open,high,low,latest,amount,volume,changeRatio"}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.wanxingai.com/openapi/real_time_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/real_time_quotation/ \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer sk-********" \\
-d '{"stock_code": "600519.SH", "indicators": "preClose,open,high,low,latest,amount,volume,changeRatio"}'