# 太一数据 OneShare 接口文档

---

> 面向金融数据开发、量化研究与 Coding 工具的完整接口说明。

---

# 核心功能

---

# OneShare 市场数据接口文档

> 专业、实时、全面的金融数据接口

## 快速开始

太一数据提供 A 股、港股市场数据 MCP 与 HTTP API 服务，覆盖实时与历史行情、财务数据、技术指标、基金估值、交易日历、公告、指数行情、金融搜索和宏观经济数据。

### 基础信息

| 项目 | 说明 |
| --- | --- |
| Base URL | `https://api.wanxingai.com/openapi/` |
| 请求方法 | `POST`，JSON Body |
| 认证方式 | `Authorization: Bearer <your-api-key>` |
| Content-Type | `application/json` |

### 调用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_stock_basic_info/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********",
}
payload = {"stock_code": "600519.SH"}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

### 面向 Coding 工具

- 下载当前页面：页面右上角选择“下载本页 MD”
- 下载完整文档：选择“下载全部 MD”
- AI 工具索引：访问 `/docs/llms.txt`
- AI 工具全文：访问 `/docs/llms-full.txt`

---

# 股票代码工具

---

# 股票名称转代码

> 通过股票名称查询完整的股票代码

## 接口基本信息

- **接口名称**: `get_stock_code`
- **功能描述**: 通过股票名称查询完整的股票代码（含交易所后缀），支持模糊匹配，自动纠正错误名称
- **数据更新频率**: 实时
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_stock_code/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 描述 | 示例 |
| --- | --- | --- | --- | --- |
| `stock_name` | str | **是** | 股票名称（支持简称或全称） | `贵州茅台` |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `name` | str | 输入的股票名称 |
| `corrected_name` | str | 纠正后的正确名称（如有错别字） |
| `stock_code` | str | 完整的股票代码（含交易所后缀） |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_stock_code/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {"stock_name": "贵州茅台"}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"stock_name": "贵州茅台"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_stock_code/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/get_stock_code/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{"stock_name": "贵州茅台"}'
```

### 注意事项

1. 支持模糊匹配，输入部分名称也可查询
2. 自动纠正常见错别字
3. 返回代码格式：代码。交易所（如 600519.SH）

---

# 证券代码搜索

> 搜索证券代码及相关信息

## 接口基本信息

- **接口名称**: `search_securities_code`
- **功能描述**: 通过行情代码或证券简称查询标准代码，支持多条件筛选
- **数据更新频率**: 实时
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/search_securities_code/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `query` | str | **是** | — | 查询内容：行情代码（如 000001）或证券简称（如 平安银行） | `000001` |
| `mode` | str | 否 | `seccode` | 查询模式：`seccode`-按代码查 / `secname`-按名称查 | `seccode` |
| `sectype` | str | 否 | `""` | 证券类型，空=查所有；`001`-股票 / `002`-基金 等 | `001` |
| `market` | str | 否 | `""` | 市场代码，空=查所有；`212001`-上交所 / `212100`-深交所 / `212200`-港交所 | `212100` |
| `tradestatus` | str | 否 | `"0"` | 交易状态：`"0"`-全部 / `"1"`-正常交易 / `"2"`-已停牌 | `1` |
| `isexact` | str | 否 | `"0"` | 是否精确匹配：`"0"`-模糊 / `"1"`-精确 | `0` |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `seccode` | str | 输入的查询代码 |
| `table.code` | str | 匹配到的所有标准代码，以英文逗号拼接为一个字符串 |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/search_securities_code/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {"query": "000001", "mode": "seccode"}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"query": "000001", "mode": "seccode"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/search_securities_code/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/search_securities_code/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{"query": "000001", "mode": "seccode"}'
```

### 注意事项

1. code 返回的是将所有匹配结果以逗号拼接的**单个字符串**，并非字符串数组
2. 一个行情代码可能对应多个市场（如 000001 同时存在于深交所和上交所）

---

# 行情数据

---

# 股票实时行情

> 获取股票实时行情数据

## 接口基本信息

- **接口名称**: `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[] | 换手率（%） |

## 使用示例

```python
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())
```

```java
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
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"}'
```

---

# 股票历史行情

> 查询股票历史行情数据

## 接口基本信息

- **接口名称**：`get_stock_history_quotation`
- **当前版本**：`v2`
- **功能描述**：获取股票历史日线行情数据，支持显式选择复权方式
- **数据更新频率**：日线
- **请求方法**：`POST`
- **API 路径**：`https://api.wanxingai.com/openapi/stock_history_quotation/`

---

## 使用示例

以下示例显式请求不复权日线：

```python
import requests

url = "https://api.wanxingai.com/openapi/stock_history_quotation/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "stock_code": "600519.SH",
    "indicators": "preClose,open,high,low,close,amount,volume,changeRatio",
    "startdate": "2025-01-01",
    "enddate": "2025-01-31",
    "adjustment": "none"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"stock_code": "600519.SH",
     "indicators": "preClose,open,high,low,close,amount,volume,changeRatio",
     "startdate": "2025-01-01", "enddate": "2025-01-31",
     "adjustment": "none"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/stock_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
curl -X POST https://api.wanxingai.com/openapi/stock_history_quotation/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"stock_code":"600519.SH","indicators":"preClose,open,high,low,close,amount,volume,changeRatio","startdate":"2025-01-01","enddate":"2025-01-31","adjustment":"none"}'
```

## 输入参数说明

| 参数名 | 类型 | 必选 | 描述 | 示例 |
| --- | --- | --- | --- | --- |
| `stock_code` | string | **是** | 完整股票代码，需含交易所后缀；最多支持 10 个股票，以英文逗号分隔 | `600519.SH` |
| `indicators` | string | **是** | 指标列表，以英文逗号分隔 | `open,high,low,close` |
| `startdate` | string | **是** | 开始日期，格式 `YYYY-MM-DD` | `2025-01-01` |
| `enddate` | string | **是** | 结束日期，格式 `YYYY-MM-DD` | `2025-03-31` |
| `adjustment` | string | 否 | 复权方式；允许值见下表。未传时默认为 `forward_cash`，以兼容既有调用 | `none` |

### adjustment 允许值

| 参数值 | 含义 |
| --- | --- |
| `none` | 不复权 |
| `backward_cash` | 后复权（现金分红） |
| `forward_cash` | 前复权（现金分红） |
| `backward_reinvest` | 后复权（分红再投） |
| `forward_reinvest` | 前复权（分红再投） |

复权方式影响 `preClose`、`open`、`high`、`low`、`close` 等价格字段，不改变成交量。显式取得与不复权分钟行情相同价格口径的日线时，请传：

```json
{
  "stock_code": "600000.SH",
  "indicators": "preClose,open,high,low,close,volume",
  "startdate": "2026-06-18",
  "enddate": "2026-06-18",
  "adjustment": "none"
}
```

## 返回结构

成功时 HTTP 状态为 200，业务 `status=200`：

```json
{
  "status": 200,
  "message": [
    {
      "thscode": "600000.SH",
      "time": ["2026-06-18"],
      "table": {
        "preClose": [9.24],
        "open": [9.20],
        "high": [9.25],
        "low": [9.07],
        "close": [9.09],
        "volume": [83656385]
      }
    }
  ]
}
```

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `status` | integer | 业务状态码；成功为 200 |
| `message` | array | 股票行情结果列表 |
| `message[].thscode` | string | 股票代码 |
| `message[].time` | string[] | 交易日期数组 |
| `message[].table` | object | 按请求指标返回的数据列 |
| `message[].table.preClose` | float[] | 前收盘价，单位：元 |
| `message[].table.open` | float[] | 开盘价，单位：元 |
| `message[].table.high` | float[] | 最高价，单位：元 |
| `message[].table.low` | float[] | 最低价，单位：元 |
| `message[].table.close` | float[] | 收盘价，单位：元 |
| `message[].table.amount` | float[] | 成交额，单位：元 |
| `message[].table.volume` | integer[] | 成交量，单位：股 |
| `message[].table.changeRatio` | float[] | 涨跌幅，单位：% |
| `message[].table.turnoverRatio` | float[] | 换手率，单位：% |

## 支持的常用指标

| 指标名 | 中文含义 | 说明 |
| --- | --- | --- |
| `preClose` | 前收盘价 | 上一交易日收盘价 |
| `open` | 开盘价 | 当日开盘价格 |
| `high` | 最高价 | 当日最高成交价 |
| `low` | 最低价 | 当日最低成交价 |
| `close` | 收盘价 | 当日收盘价格；正式字段为 `close` |
| `amount` | 成交额 | 当日成交总金额，单位：元 |
| `volume` | 成交量 | 当日成交总量，单位：股 |
| `changeRatio` | 涨跌幅 | 相对前收盘价的涨跌幅，单位：% |
| `turnoverRatio` | 换手率 | 成交量占流通股本的比例，单位：% |

## 版本记录

### v2（2026-07-21）

- 新增可选参数 `adjustment`，支持不复权、现金分红前后复权、分红再投前后复权。
- 未传 `adjustment` 时保持既有默认口径：`forward_cash`。
- 明确日线收盘价正式请求指标和返回字段为 `close`。
- 明确日线 `volume` 单位为股。

---

---

# 高频行情数据

> 获取高频行情数据

## 接口基本信息

- **接口名称**: `get_high_frequency_quotes`
- **功能描述**: 获取股票/期货/期权高频（分钟级）行情数据
- **数据更新频率**: 分钟级
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_high_frequency_quotes/`

---

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_high_frequency_quotes/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "stock_code": "300033.SZ",
    "indicators": "open,high,low,close,volume,amount",
    "starttime": "2024-01-02 09:30:00",
    "endtime": "2024-01-02 15:00:00",
    "interval": "5",
    "cps": "forward3"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"stock_code": "300033.SZ", "indicators": "open,high,low,close,volume,amount",
     "starttime": "2024-01-02 09:30:00", "endtime": "2024-01-02 15:00:00",
     "interval": "5", "cps": "forward3"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_high_frequency_quotes/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/get_high_frequency_quotes/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{"stock_code": "300033.SZ", "indicators": "open,high,low,close,volume,amount", "starttime": "2024-01-02 09:30:00", "endtime": "2024-01-02 15:00:00", "interval": "5", "cps": "forward3"}'
```

## 输入参数说明

| 参数名 | 类型 | 必选 | 描述 | 示例 |
| --- | --- | --- | --- | --- |
| `stock_code` | str | **是** | 完整股票代码 | `300033.SZ` |
| `indicators` | str | **是** | 指标，英文逗号分隔 | `tradeDate,tradeTime,latest` |
| `starttime` | str | **是** | 开始时间，格式 YYYY-MM-DD HH:mm:ss | `2025-08-25 09:30:00` |
| `endtime` | str | **是** | 结束时间，须与 starttime 同一天 | `2025-08-25 15:00:00` |
| `interval` | str | 否 | 时间周期（分钟）：1/3/5/10/15/30/60 | `5` |
| `cps` | str | 否 | 复权方式：no-不复权, backward1-后复权, forward3-前复权 | `forward3` |

### 返回数据说明

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| code | string | 股票代码 |
| time | string[] | 时间序列（YYYY-MM-DD HH:mm，无秒） |
| table | object | 行情数据表，字段随 indicators 参数变化 |
| table.open | float[] | 开盘价 |
| table.high | float[] | 最高价 |
| table.low | float[] | 最低价 |
| table.close | float[] | 收盘价 |
| table.volume | float[] | 成交量 |
| table.amount | float[] | 成交额 |
| table.changeRatio | float[] | 涨跌幅（%） |
| table.turnoverRatio | float[] | 换手率（%） |

---

### 支持的指标列表

| 指标名 | 中文含义 | 说明 |
| --- | --- | --- |
| `tradeDate` | 交易日期 | 成交日期 |
| `tradeTime` | 交易时间 | 成交时间（精确到秒） |
| `latest` | 最新价 | 当前最新成交价格 |
| `vol` | 成交量 | 截至当前的成交总量（手） |
| `bid1/ask1` | 买一/卖一价 | 买一档/卖一档报价 |

---

---

# 日内快照数据

> 查询日内快照数据

## 接口基本信息

- **接口名称**: `get_intraday_snapshot`
- **功能描述**: 获取股票日内逐笔快照数据（starttime 与 endtime 须在同一交易日）
- **数据更新频率**: 实时
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_intraday_snapshot/`

---

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_intraday_snapshot/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "stock_code": "300033.SZ",
    "indicators": "tradeDate,tradeTime,latest,vol,bid1,ask1",
    "starttime": "2025-08-25 09:30:00",
    "endtime": "2025-08-25 15:00:00"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"stock_code": "300033.SZ", "indicators": "tradeDate,tradeTime,latest,vol,bid1,ask1",
     "starttime": "2025-08-25 09:30:00", "endtime": "2025-08-25 15:00:00"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_intraday_snapshot/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/get_intraday_snapshot/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{"stock_code": "300033.SZ", "indicators": "tradeDate,tradeTime,latest,vol,bid1,ask1", "starttime": "2025-08-25 09:30:00", "endtime": "2025-08-25 15:00:00"}'
```

## 输入参数说明

| 参数名 | 类型 | 必选 | 描述 | 示例 |
| --- | --- | --- | --- | --- |
| `stock_code` | str | **是** | 完整股票代码，多个用英文逗号分隔。支持最多10个 | `600519.SH` |
| `indicators` | str | **是** | 指标，英文逗号分隔。常用：tradeDate,tradeTime,preClose,open,high,low,latest,vol,amount,bid1,ask1,bidSize1,askSize1 | `latest,vol,amount` |
| `starttime` | str | **是** | 开始时间 "YYYY-MM-DD HH:mm:ss" | `2025-08-25 09:30:00` |
| `endtime` | str | **是** | 结束时间 "YYYY-MM-DD HH:mm:ss"，须与 starttime 同一天 | `2025-08-25 15:00:00` |

### 返回数据说明

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| code | string | 股票代码 |
| time | string[] | 交易时间序列（3秒级精度） |
| table.tradeDate | string[] | 交易日期 |
| table.tradeTime | string[] | 交易时间（HH:mm:ss） |
| table.preClose | float[] | 前收盘价 |
| table.open | float[] | 开盘价 |
| table.high | float[] | 最高价 |
| table.low | float[] | 最低价 |
| table.latest | float[] | 最新价 |
| table.vol | float[] | 成交量 |
| table.amount | float[] | 成交额 |
| table.bid1 | float[] | 买一价 |
| table.ask1 | float[] | 卖一价 |
| table.bidSize1 | float[] | 买一量 |
| table.askSize1 | float[] | 卖一量 |

---

### 常用财务指标

| 指标名 | 中文含义 |
| --- | --- |
| `ths_roe_stock` | 净资产收益率（ROE） |
| `ths_net_profit_stock` | 归母净利润 |
| `ths_total_revenue_stock` | 营业总收入 |
| `ths_eps_stock` | 每股收益（EPS） |
| `ths_asset_liability_ratio_stock` | 资产负债率 |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `code` | str | 标准股票代码 |
| `time` | array[str] | 日期序列数组，格式 YYYY-MM-DD |
| `table` | object | 指标数据对象，字段名与传入的 indicator 参数名称对应 |

---

---

# 日行情与技术指标

> 日行情与技术指标查询

## 接口基本信息

- **接口名称**：`get_stock_daily_quotes_tech`
- **功能描述**：查询 A 股指定日期的日行情与技术指标，共 76 项
- **契约版本**：v2
- **请求方法**：`POST`
- **API 路径**：`https://api.wanxingai.com/openapi/get_stock_daily_quotes_tech/`
- **认证方式**：`Authorization: Bearer <API Key>`


## 请求参数

| 参数名 | 类型 | 必选 | 默认值 | 说明 |
| --- | --- | --- | --- | --- |
| `stock_code` | string | **是** | — | 完整股票代码，需含交易所后缀；多个代码用英文逗号分隔，例如 `600000.SH` |
| `date` | string | 否 | 当天 | 查询日期，格式为 `YYYY-MM-DD`；支持查询数据源覆盖范围内的历史交易日 |
| `indicators` | string[] | 否 | 全部 76 项 | 高级筛选参数，只填写下表中的公开指标名，例如 `["macd_stock","rsi_stock"]` |

### 默认请求：返回全部 76 项

```json
{
  "stock_code": "600000.SH",
  "date": "2026-06-18"
}
```

### 筛选请求：只返回指定指标

```json
{
  "stock_code": "600000.SH",
  "date": "2026-06-18",
  "indicators": ["macd_stock", "rsi_stock", "boll_stock"]
}
```

为方便脚本调用，服务端同时兼容逗号分隔字符串，如 `"macd_stock,rsi_stock"`。旧版对象数组仅做兼容读取；客户端传入的 `indiparams` 不会生效，所有计算参数均由服务端按接口版本维护。

## 响应结构

HTTP 层正常时返回 HTTP 200，业务结果由响应中的 `status` 表示。

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `status` | integer | `200` 成功；`201` 请求参数校验失败；`401` 账户余额或权限校验失败；`500` 服务端或数据源调用失败 |
| `message` | array | 成功时的数据列表 |
| `message[].thscode` | string | 股票代码 |
| `message[].query_date` | string | 实际查询日期 |
| `message[].data` | array | 指标列表 |
| `message[].data[].indicator` | string | 公开指标名，不含 `ths_` 前缀 |
| `message[].data[].value` | number/string/null | 指标值；数据源在该日无值时可能为 `null` |
| `error` | string | 失败时的错误说明 |

## 76 项指标清单

| # | indicator | 说明 |
| ---: | --- | --- |
| 1 | `up_days_stock` | 连涨天数 |
| 2 | `down_days_stock` | 连跌天数 |
| 3 | `his_high_stock` | 创历史新高 |
| 4 | `his_low_stock` | 创历史新低 |
| 5 | `phase_high_stock` | 创阶段新高 |
| 6 | `phase_low_stock` | 创阶段新低 |
| 7 | `up_valid_break_ma_stock` | 向上有效突破均线 |
| 8 | `down_valid_break_ma_stock` | 向下有效突破均线 |
| 9 | `up_open_date_stock` | 涨停打开日 |
| 10 | `dl_open_date_stock` | 跌停打开日 |
| 11 | `long_or_short_by_avg_line_stock` | 均线多空头排列看涨看跌 |
| 12 | `maxup_nd_stock` | N 天 M 板 |
| 13 | `his_high_nearly_days_stock` | 近期创历史新高次数 |
| 14 | `his_low_nearly_days_stock` | 近期创历史新低次数 |
| 15 | `vol_ratio_stock` | 量比 |
| 16 | `tapi_stock` | TAPI 加权指数成交值 |
| 17 | `vma_stock` | VMA 量简单移动平均 |
| 18 | `vmacd_stock` | VMACD 量指数平滑异同平均 |
| 19 | `vosc_stock` | VOSC 成交量震荡 |
| 20 | `vstd_stock` | VSTD 成交量标准差 |
| 21 | `cr_stock` | CR 能量指标 |
| 22 | `psy_stock` | PSY 心理指标 |
| 23 | `vr_stock` | VR 成交量比率 |
| 24 | `arbr_stock` | 人气意愿指标（ARBR） |
| 25 | `wad_stock` | WAD 威廉聚散指标 |
| 26 | `mfi_stock` | MFI 资金流向指标 |
| 27 | `obv_stock` | OBV 能量潮 |
| 28 | `pvt_stock` | PVT 量价趋势指标 |
| 29 | `wvad_stock` | WVAD 威廉变异离散量 |
| 30 | `bbi_stock` | BBI 多空指数 |
| 31 | `ddi_stock` | DDI 方向标准差偏离指数 |
| 32 | `dma_stock` | DMA 平均线差 |
| 33 | `ma_stock` | MA 简单移动平均 |
| 34 | `expma_stock` | EXPMA 指数平均数 |
| 35 | `macd_stock` | MACD 指数平滑异同平均 |
| 36 | `mtm_stock` | MTM 动力指标 |
| 37 | `price_osc_stock` | PRICEOSC 价格振荡指标 |
| 38 | `trix_stock` | TRIX 三重指数平滑平均 |
| 39 | `ddzbczq_stock` | 顶底指标（长周期） |
| 40 | `ddzbzzq_stock` | 顶底指标（中周期） |
| 41 | `bias_stock` | BIAS 乖离率 |
| 42 | `cci_stock` | CCI 顺势指标 |
| 43 | `dbcd_stock` | DBCD 异同离差乖离率 |
| 44 | `dpo_stock` | DPO 区间震荡线 |
| 45 | `kdj_stock` | KDJ 随机指标 |
| 46 | `lwr_stock` | LWR 威廉指标 |
| 47 | `roc_stock` | ROC 变动速率 |
| 48 | `rsi_stock` | RSI 相对强弱指标 |
| 49 | `si_stock` | SI 摆动指标 |
| 50 | `srdm_stock` | SRDM 动向速度比率 |
| 51 | `vroc_stock` | VROC 量变动速率 |
| 52 | `vrsi_stock` | VRSI 量相对强弱 |
| 53 | `wr_stock` | WR 威廉指标 |
| 54 | `b3612_stock` | B3612 三减六日乖离 |
| 55 | `adtm_stock` | ADTM 动态买卖气指标 |
| 56 | `skdj_stock` | SKDJ 慢速随机指标 |
| 57 | `bbiboll_stock` | BBIBOLL 多空布林线 |
| 58 | `boll_stock` | BOLL 布林线 |
| 59 | `cdp_stock` | CDP 逆势操作 |
| 60 | `sar_stock` | SAR 抛物转向指标 |
| 61 | `env_stock` | ENV 指标 |
| 62 | `mike_stock` | MIKE 麦克指标 |
| 63 | `dptb_stock` | DPTB 大盘同步指标 |
| 64 | `jdqs_stock` | JDQS 阶段强势指标 |
| 65 | `jdrs_stock` | JDRS 阶段弱势指标 |
| 66 | `zdzb_stock` | ZDZB 筑底指标 |
| 67 | `mi_stock` | MI 动量指标 |
| 68 | `micd_stock` | MICD 异同离差动力指数 |
| 69 | `rc_stock` | RC 变化率指数 |
| 70 | `rccd_stock` | RCCD 异同离差变化率指数 |
| 71 | `srmi_stock` | SRMI（MI 修正指标） |
| 72 | `atr_stock` | ATR 真实波幅 |
| 73 | `cvlt_stock` | CVLT 佳庆离散指标 |
| 74 | `mass_stock` | MASS 梅斯线 |
| 75 | `std_stock` | STD 标准差 |
| 76 | `vhf_stock` | VHF 纵横指标 |

## 调用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_stock_daily_quotes_tech/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "stock_code": "600000.SH",
    "date": "2026-06-18"
}

response = requests.post(url, json=payload, headers=headers, timeout=30)
print(response.json())
```

```bash
curl -X POST 'https://api.wanxingai.com/openapi/get_stock_daily_quotes_tech/' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer sk-********' \
  -d '{"stock_code":"600000.SH","date":"2026-06-18"}'
```

## 历史日期与数据口径

- `date` 可以指定历史日期，不传时使用服务器当天日期。
- 历史可查询范围取决于数据源覆盖范围；当前接口不承诺固定的数据保留年限。超出覆盖范围或非交易日时，相关指标可能为空。
- 技术指标基于历史行情计算，仅供研究参考。
- 本接口不返回每日明确的涨停价或跌停价。`up_open_date_stock` 和 `dl_open_date_stock` 是“涨跌停打开日”类指标，不是价格字段。
- 在平台提供正式的每日涨跌停价格接口或字段前，客户端不应根据证券板块、ST 状态或固定百分比自行猜测涨跌停价格。

---

# 基金数据

---

# 基金实时估值

> 查询基金实时估值

## 接口基本信息

- **接口名称**: `get_fund_realtime_valuation`
- **功能描述**: 获取基金实时估值（分钟频）。交易时段外返回空数组
- **数据更新频率**: 分钟级
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_fund_realtime_valuation/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `fund_codes` | str | **是** | — | 基金代码，英文逗号分隔 | `110011.OF,000001.OF` |
| `outputpara` | str | **是** | — | 输出字段控制，格式 `"字段名:Y,字段名:Y"`，可用字段见下表 | `changeRatioValuation:Y,realTimeValuation:Y` |
| `only_latest` | str | 否 | `"1"` | `"1"`-仅返回最新估值；`"0"`-返回时间区间 | `1` |
| `begin_time` | str | 否 | `""` | 开始时间（only\_latest="0" 时必填），格式 YYYY-MM-DD HH:mm:ss | `2026-04-17 09:30:00` |
| `end_time` | str | 否 | `""` | 结束时间（only\_latest="0" 时必填），格式 YYYY-MM-DD HH:mm:ss | `2026-04-17 15:00:00` |

---

### outputpara 可用字段

| 字段名 | 中文含义 |
| --- | --- |
| `changeRatioValuation` | 估值涨跌幅（%） |
| `realTimeValuation` | 实时估值净值（元） |
| `Deviation30TDays` | 30个交易日均偏差率（%） |
| `rank` | 估值涨跌幅排名 |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `fundcode` | str | 基金代码 |
| `time` | array[str] | 估值时间序列 |
| `table` | object | 估值数据对象（字段由 outputpara 决定） |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_fund_realtime_valuation/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
# 查询最新估值
payload = {
    "fund_codes": "110011.OF",
    "outputpara": "changeRatioValuation:Y,realTimeValuation:Y,rank:Y",
    "only_latest": "1"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())

# 查询时间区间估值
payload2 = {
    "fund_codes": "110011.OF",
    "outputpara": "changeRatioValuation:Y,realTimeValuation:Y",
    "only_latest": "0",
    "begin_time": "2026-04-17 09:30:00",
    "end_time": "2026-04-17 15:00:00"
}
resp2 = requests.post(url, json=payload2, headers=headers)
print(resp2.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"fund_codes": "110011.OF", "outputpara": "changeRatioValuation:Y,realTimeValuation:Y,rank:Y", "only_latest": "1"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_fund_realtime_valuation/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/get_fund_realtime_valuation/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"fund_codes": "110011.OF", "outputpara": "changeRatioValuation:Y,realTimeValuation:Y,rank:Y", "only_latest": "1"}'
```

### 注意事项

1. 非交易时段调用返回空数组 `[]`
2. 当 `only_latest="0"` 时，`begin_time` 和 `end_time` 为必填

---

# 基金日度估值

> 获取基金日度估值数据

## 接口基本信息

- **接口名称**: `get_fund_daily_valuation`
- **功能描述**: 获取基金日最终估值（日频）
- **数据更新频率**: 每日更新
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_fund_daily_valuation/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 描述 | 示例 |
| --- | --- | --- | --- | --- |
| `fund_codes` | str | **是** | 基金代码，英文逗号分隔 | `000001.OF` |
| `begin_date` | str | **是** | 开始日期，格式 YYYY-MM-DD | `2024-01-01` |
| `end_date` | str | **是** | 结束日期，格式 YYYY-MM-DD | `2024-12-31` |
| `outputpara` | str | 否 | 输出字段控制，默认全部 | `finalValuation:Y` |

---

### 支持的指标列表

| 指标名 | 中文含义 |
| --- | --- |
| `finalValuation` | 日最终估值 |
| `netAssetValue` | 日实际净值 |
| `deviation` | 估值偏差率 |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_fund_daily_valuation/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "fund_codes": "000001.OF",
    "begin_date": "2026-01-01",
    "end_date": "2026-04-17"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = "{
     "fund_codes": "000001.OF",
     "begin_date": "2026-01-01",
     "end_date": "2026-04-17"
}";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_fund_daily_valuation/"))
    .header("Content-Type", "application/json")
    .header("Authorization", "Bearer sk-********")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

```curl
curl -X POST https://api.wanxingai.com/openapi/get_fund_daily_valuation/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"fund_codes": "000001.OF", "begin_date": "2026-01-01", "end_date": "2026-04-17"}'
```

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `marketcode` | str | **是** | — | 交易所代码：`212001`-上交所 / `212100`-深交所 / `212200`-港交所 | `212001` |
| `startdate` | str | **是** | — | 开始日期，格式 YYYY-MM-DD | `2026-04-01` |
| `enddate` | str | **是** | — | 结束日期，格式 YYYY-MM-DD | `2026-04-18` |
| `date_type` | str | 否 | `"0"` | 日期类型：`"0"`-交易日 / `"1"`-日历日 | `0` |
| `period` | str | 否 | `"D"` | 时间周期：`D`-日 / `W`-周 / `M`-月 / `Q`-季 / `S`-半年 / `Y`-年 | `D` |
| `date_format` | str | 否 | `"0"` | 返回日期格式：`"0"`-YYYY-MM-DD / `"1"`-YYYY/MM/DD / `"2"`-YYYYMMDD | `0` |
| `mode` | str | 否 | `"1"` | `"1"`-返回区间所有日期 / `"2"`-仅返回日期数量 | `1` |

---

### 常用 marketcode 列表

| 市场代码 | 市场名称 |
| --- | --- |
| `212001` | 上海证券交易所（上交所） |
| `212100` | 深圳证券交易所（深交所） |
| `212200` | 香港证券交易所（港交所） |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `time` | array[str] | 交易日期列表（mode="1" 时） |
| `count` | int | 交易日数量（mode="2" 时） |

---

---

# 日期工具

---

# 交易日查询

> 查询交易日信息

## 接口基本信息

- **接口名称**: `query_trading_dates`
- **功能描述**: 查询指定市场的交易日历，返回区间内的交易日期列表或数量
- **数据更新频率**: 实时
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/query_trading_dates/`

---

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/query_trading_dates/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
# 返回所有交易日
payload = {
    "marketcode": "212001",
    "startdate": "2026-04-01",
    "enddate": "2026-04-18",
    "mode": "1"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"marketcode": "212001", "startdate": "2026-04-01", "enddate": "2026-04-18", "mode": "1"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/query_trading_dates/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/query_trading_dates/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"marketcode": "212001", "startdate": "2026-04-01", "enddate": "2026-04-18", "mode": "1"}'
```

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `marketcode` | str | **是** | — | 交易所代码（212001-上交所, 212100-深交所, 212200-港交所） | `212001` |
| `startdate` | str | **是** | — | 开始日期，格式 YYYY-MM-DD | `2026-04-01` |
| `enddate` | str | **是** | — | 结束日期，格式 YYYY-MM-DD | `2026-04-18` |
| `date_type` | str | 否 | "0" | 日期类型："0"-交易日, "1"-日历日 | `0` |
| `period` | str | 否 | "D" | 时间周期：D-日, W-周, M-月, Q-季, S-半年, Y-年 | `D` |
| `date_format` | str | 否 | "0" | 返回日期格式："0"-YYYY-MM-DD, "1"-YYYY/MM/DD, "2"-YYYYMMDD | `0` |
| `mode` | str | 否 | "1" | "1"-返回区间所有日期, "2"-仅返回日期数量 | `1` |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `time` | array[str] | 偏移后的日期（singledate 时为单元素数组，sequencedate 时为完整序列） |

---

---

# 交易日偏移

> 计算交易日偏移

## 接口基本信息

- **接口名称**: `offset_trading_date`
- **功能描述**: 计算基准日期偏移若干个交易日/周/月后的日期
- **数据更新频率**: 实时
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/offset_trading_date/`

---

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/offset_trading_date/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
# 基准日 2026-04-18，前推 5 个交易日
payload = {
    "marketcode": "212001",
    "startdate": "2026-04-18",
    "offset": "-5"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"marketcode": "212001", "startdate": "2026-04-18", "offset": "-5"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/offset_trading_date/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/offset_trading_date/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"marketcode": "212001", "startdate": "2026-04-18", "offset": "-5"}'
```

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `marketcode` | str | **是** | — | 交易所代码（如 212001-上交所） | `212001` |
| `startdate` | str | **是** | — | 基准日期，格式 YYYY-MM-DD | `2026-04-18` |
| `offset` | str | **是** | — | 偏移量，前推为负数（如 "-5"），后推为正数（如 "5"） | `-5` |
| `period` | str | 否 | "D" | 时间周期：D-日, W-周, M-月, Q-季, S-半年, Y-年 | `D` |
| `date_type` | str | 否 | "0" | 日期类型："0"-交易日, "1"-日历日 | `0` |
| `date_format` | str | 否 | "0" | 返回日期格式："0"-YYYY-MM-DD, "1"-YYYY/MM/DD, "2"-YYYYMMDD | `0` |
| `output` | str | 否 | "singledate" | "singledate"-返回单个日期, "sequencedate"-返回所有日期序列 | `singledate` |

---

### 返回数据说明

返回 JSON 数组，格式为 `[{code, data: [{indicator, description, value}]}]`

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `code` | str | 标准股票代码 |
| `data` | array[object] | 指标数组，每项含 indicator、description、value |

---

### 完整指标列表（共 25 项）

| 分类 | indicator | description |
| --- | --- | --- |
| 基础信息 | `stock_short_name_stock` | 股票简称 |
| `en_short_name_stock` | 英文简称 |
| `phonetic_short_name_stock` | 简称首拼 |
| `sec_name_used_before_stock` | 证券曾用名 |
| `stock_code_stock` | 股票代码 |
| 关联市场 | `corp_hshare_short_name_stock` | 同公司H股简称 |
| `corp_hshare_code_stock` | 同公司H股代码 |
| `us_ticker_stock` | 同公司美股简称 |
| `us_stock_code_stock` | 同公司美股代码 |
| 上市信息 | `stock_varieties_stock` | 股票种类（如A股） |
| `ipo_date_stock` | 首发上市日期 |
| `backdoor_listing_date_stock` | 借壳上市日期 |
| `listing_exchange_stock` | 上市交易所 |
| `listedsector_stock` | 上市板块 |
| `trade_currency_stock` | 交易币种 |
| 概念分类 | `the_concept_stock` | 所属概念 |
| `corp_cb_stock` | 同公司可转债简称 |
| 状态标识 | `listed_status_stock` | 上市状态 |
| `is_risk_warning_board_stock` | 是否属于风险警示板 |
| `is_important_index_constituent_stock` | 是否属于重要指数成分 |
| `index_weight_stock` | 所属指数权重 |
| `is_mt_ss_underlying_stock` | 是否融资融券标的 |
| `is_shhk_buy_underlying_stock` | 是否沪港通买入标的 |

（其余指标：`is_szhk_buy_underlying_stock` 是否深港通买入标的、`is_subnew_stock_stock` 是否为次新股）

---

---

# 公司信息

---

# 股票基本信息

> 获取股票基本信息

## 接口基本信息

- **接口名称**: `get_stock_basic_info`
- **功能描述**: 查询A股股票基本信息摘要（25项静态/基础指标）
- **数据更新频率**: 静态数据
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_stock_basic_info/`

---

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_stock_basic_info/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "stock_code": "600519.SH"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = "{
     "stock_code": "600519.SH"
}";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_stock_basic_info/"))
    .header("Content-Type", "application/json")
    .header("Authorization", "Bearer sk-********")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

```curl
curl -X POST https://api.wanxingai.com/openapi/get_stock_basic_info/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"stock_code": "600519.SH"}'
```

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `stock_code` | str | **是** | — | 完整股票代码，多个用英文逗号分隔 | `600519.SH` |

---

### 返回数据说明

返回 JSON 数组，格式为 `[{code, query_date, data: [{indicator, description, value}]}]`

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `code` | str | 标准股票代码 |
| `query_date` | str | 实际查询日期 |
| `data` | array[object] | 指标数组，每项含 indicator、description、value |

---

### 完整指标列表（共 30 项）

| 分类 | indicator | description |
| --- | --- | --- |
| 公司基本信息 | `corp_cn_name_stock` | 公司中文名称 |
| `corp_name_en_stock` | 公司英文名称 |
| `established_date_stock` | 成立日期 |
| `business_reg_num_stock` | 工商登记号 |
| `unified_social_credit_code_stock` | 统一社会信用代码 |
| `reg_capital_stock` | 注册资本（元） |
| 股权与控制 | `controlling_holder_stock` | 控股股东 |
| `controlling_holder_held_ratio_stock` | 控股股东持股比例（%） |
| `actual_controller_stock` | 实际控制人 |
| `actual_controller_held_ratio_stock` | 实际控制人持股比例（%） |
| `actual_controller_type_stock` | 实际控制人类型 |
| 经营信息 | `company_saclle_type_stock` | 企业类型 |
| `operating_scope_stock` | 经营范围 |
| 高管信息 | `legal_representative_stock` | 法人代表 |
| `chairman_current_stock` | 董事长(现任) |
| `chairman_his_stock` | 董事长(历任) |
| `cfo_current_stock` | 财务总监(现任) |
| `secretary_current_stock` | 董事会秘书(现任) |
| 主营业务 | `main_businuess_stock` | 主营业务 |
| `mo_product_name_stock` | 主营产品名称 |
| `mo_product_type_stock` | 主营产品类型 |
| `opponent_company_stock` | 竞争公司 |
| 行业分类 | `the_new_csrc_industry_stock` | 所属新证监会行业 |
| `the_new_csrc_industry_code_stock` | 所属新证监会行业代码 |
| `the_sw_industry_stock` | 所属申万行业 |
| `the_sw_industry_code_stock` | 所属申万行业代码 |

（其余指标：`currency_registered_capital_stock` 注册资本币种、`cfo_his_stock` 财务总监历任、`secretary_his_stock` 董事会秘书历任、`comparing_company_stock` 可比公司）

---

---

# 上市公司信息

> 查询上市公司详细信息

## 接口基本信息

- **接口名称**: `get_listed_company_info`
- **功能描述**: 查询A股证券与上市公司基本资料（30项指标）
- **数据更新频率**: 静态数据
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_listed_company_info/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `stock_code` | str | **是** | — | 完整股票代码，需含交易所后缀，多个用英文逗号分隔 | `600519.SH` |
| `date` | str | 否 | "" | 查询时间点，格式 YYYY-MM-DD。不传则默认使用今天日期 | `2026-04-17` |

### 返回数据说明

| indicator | 说明 |
| --- | --- |
| `corp_cn_name_stock` | 公司中文名称 |
| `corp_name_en_stock` | 公司英文名称 |
| `established_date_stock` | 成立日期 |
| `reg_capital_stock` | 注册资本 |
| `controlling_holder_stock` | 控股股东 |
| `controlling_holder_held_ratio_stock` | 控股股东持股比例 |
| `actual_controller_stock` | 实际控制人 |
| `actual_controller_type_stock` | 实际控制人类型 |
| `company_saclle_type_stock` | 企业类型 |
| `legal_representative_stock` | 法人代表 |
| `operating_scope_stock` | 经营范围 |
| `main_businuess_stock` | 主营业务 |
| `the_new_csrc_industry_stock` | 所属新证监会行业 |
| `the_sw_industry_stock` | 所属申万行业 |
| `chairman_current_stock` | 董事长(现任) |
| `chairman_his_stock` | 董事长(历任) |
| `cfo_current_stock` | 财务总监(现任) |
| `secretary_current_stock` | 董事会秘书(现任) |
| *...共 30 项指标，以上为常用字段* | |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_listed_company_info/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "stock_code": "600519.SH"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = "{
     "stock_code": "600519.SH"
}";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_listed_company_info/"))
    .header("Content-Type", "application/json")
    .header("Authorization", "Bearer sk-********")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

```curl
curl -X POST https://api.wanxingai.com/openapi/get_listed_company_info/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"stock_code": "600519.SH"}'
```

### 注意事项

1. date 参数不传则默认使用今天日期

---

# 股权股东信息

> 获取股权股东信息

## 接口基本信息

- **接口名称**: `get_stock_equity_shareholder`
- **功能描述**: 查询 A 股股本及股东数据（36 项指标），含总股本、流通/限售情况、前十大股东等
- **数据更新频率**: 季度更新
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_stock_equity_shareholder/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 描述 | 示例 |
| --- | --- | --- | --- | --- |
| `stock_code` | str | **是** | 完整股票代码，需带交易所后缀，多个用英文逗号分隔 | `600519.SH` |

---

### 返回数据说明

返回 JSON 数组，格式为 `[{code, latest_report_period, data: [{indicator, description, value}]}]`

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `code` | str | 标准股票代码 |
| `latest_report_period` | str | 最新报告期，格式 YYYYMMDD |
| `data` | array[object] | 指标数组，每项含 indicator、description、value |

---

### 完整指标列表（共 36 项）

| 分类 | indicator | description |
| --- | --- | --- |
| 股本结构 | `total_shares_stock` | 总股本 |
| `total_shares_before_listed_stock` | 上市前总股本 |
| `total_ashare_stock` | A股合计 |
| `float_ashare_stock` | 流通A股 |
| `limited_ashare_stock` | 限售A股 |
| 其他股本 | `total_bshare_stock` | B股合计 |
| `free_float_shares_stock` | 自由流通股 |
| `total_float_shares_stock` | 流通股合计 |
| `total_limited_shares_stock` | 限售股合计 |
| `depository_receipt_ratio_stock` | 预托证券对应标的股票的比例 |
| `float_ashare_exright_stock` | 流通A股（除权） |
| 第一大股东 | `holder_name_stock` | 第一大股东名称 |
| `holder_held_num_stock` | 第一大股东持股数量 |
| `holder_held_ratio_stock` | 第一大股东持股比例（%） |
| `holder_held_shares_nature_stock` | 股东持股股份性质 |
| 前十大股东 | `top10_hlolder_held_num_stock` | 前十大股东持股数量合计 |
| `top10_hlolder_held_ratio_stock` | 前十大股东持股比例合计（%） |
| `org_holder_name_stock` | 前十大机构股东名称（逗号分隔） |
| 前十大流通股东 | `float_holder_name_stock` | 前十大流通股东名称（逗号分隔） |
| `float_holder_held_ratio_stock` | 第一大流通股东持股比例（%） |
| `top10_float_hlolder_held_ratio_stock` | 前十大流通股东持股比例合计（%） |
| 股东性质 | `holder_nature_stock` | 股东性质 |
| `org_holder_type_stock` | 机构股东类型 |
| `float_holder_held_share_nature_stock` | 流通股东持股股份性质 |
| 流通股东持股市值 | `float_holder_held_mv_stock` | 流通股东持股市值 |
| 限售股 | `holder_held_ls_num_stock` | 大股东持有的限售股份数 |

（其余指标：`float_bshare_stock` 流通B股、`limited_bshare_stock` 限售B股、`neeq_ashare_stock` 股转系统A股、`neeq_bshare_stock` 股转系统B股、`neeq_sum_stock` 股转系统合计、`hk_listed_stock_stock` 香港上市股、`overseas_listed_shares_stock` 海外上市股、`float_holder_held_num_stock` 第一大流通股东持股数量、`top10_float_hlolder_held_num_stock` 前十大流通股东持股数量合计、`unfloat_shares_before_reform_stock` 股改前非流通股）

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_stock_equity_shareholder/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "stock_code": "600519.SH"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = "{
     "stock_code": "600519.SH"
}";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_stock_equity_shareholder/"))
    .header("Content-Type", "application/json")
    .header("Authorization", "Bearer sk-********")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

```curl
curl -X POST https://api.wanxingai.com/openapi/get_stock_equity_shareholder/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"stock_code": "600519.SH"}'
```

### 注意事项

1. 返回数据对应最新报告期（通过 `latest_report_period` 字段获取）

---

# 财务数据查询

> 查询财务数据

## 接口基本信息

- **接口名称**: `get_stock_financial_data`
- **功能描述**: 查询 A 股财务数据及衍生财务指标，支持资产负债表、利润表、现金流量表、现金流量补充资料及单季度数据
- **数据更新频率**: 季度/年度更新
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_stock_financial_data/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 描述 | 示例 |
| --- | --- | --- | --- | --- |
| `stock_code` | str | **是** | 完整股票代码，需带交易所后缀。多个股票可用英文逗号分隔 | `300033.SZ` |
| `date` | str | 否 | 查询日期。支持 `YYYYMMDD` 或 `YYYY-MM-DD`。不传时默认当天。系统会根据该日期自动计算最近报告期 | `20260526` |
| `unit` | str | 否 | 指标单位参数，默认 `100`。一般无需传 | `100` |
| `report_period` | str | 否 | 指定报告期。支持 `YYYYMMDD` 或 `YYYY-MM-DD`。不传时系统会根据 `date` 自动计算最近报告期。报告期通常为 `0331`、`0630`、`0930`、`1231` | `20260331` |
| `indicators` | array | **是** | 需要查询的指标列表。支持字符串或对象。字符串形式用于常规查询；对象形式可为单个指标指定特殊参数 | `["currency_fund_stock", "sq_revenue_stock"]` |

---

## 指标参数规则

系统会根据指标类型自动生成底层查询参数，用户通常只需要传入 `stock_code`、`date` 和 `indicators`。

| 指标类型 | 判断规则 | 使用参数 | 示例 |
| --- | --- | --- | --- |
| 普通财报指标 | 非 `sq_` 开头的指标 | `[最近报告期, unit]` | `["20260331", "100"]` |
| 单季度指标 | `sq_` 开头的指标 | `[当前查询日期, unit]` | `["20260526", "100"]` |
| 特殊参数指标 | 用户在单个指标中显式传入 `indiparams` | 完全使用用户传入的参数 | `["100", "2025", "100"]` |

例如传入 `date=20260526` 时，系统会自动计算最近报告期为 `20260331`。普通财报指标使用 `["20260331", "100"]`，单季度指标使用 `["20260526", "100"]`。

---

### 请求参数示例

#### 示例 1：查询普通财报指标

```
{
  "stock_code": "300033.SZ",
  "date": "20260526",
  "indicators": [
    "currency_fund_stock",
    "settle_reserves_stock",
    "total_assets_stock",
    "np_stock"
  ]
}
```

#### 示例 2：查询单季度指标

```
{
  "stock_code": "300033.SZ",
  "date": "20260526",
  "indicators": [
    "sq_revenue_stock",
    "sq_np_stock",
    "sq_np_atoopc_stock"
  ]
}
```

#### 示例 3：混合查询普通指标、单季度指标和特殊参数指标

```
{
  "stock_code": "300033.SZ",
  "date": "20260526",
  "indicators": [
    "currency_fund_stock",
    "settle_reserves_stock",
    "sq_revenue_stock",
    {
      "indicator": "sq_operating_total_cost_2_stock",
      "indiparams": ["100", "2025", "100"]
    }
  ]
}
```

---

### 返回数据说明

返回 JSON 对象，格式如下：

```
{
  "status": 200,
  "message": [
    {
      "stock_code": "300033.SZ",
      "data": [
        {
          "indicator": "currency_fund_stock",
          "description": "货币资金",
          "value": 123456789
        }
      ]
    }
  ]
}
```

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `status` | int | 状态码。`200` 表示成功，`201` 表示参数错误，`401` 表示余额不足或鉴权失败，`500` 表示服务异常 |
| `message` | array | 返回结果数组 |
| `stock_code` | str | 标准股票代码 |
| `data` | array[object] | 指标数据列表 |
| `indicator` | str | 开放平台指标名 |
| `description` | str | 指标中文名称 |
| `value` | number/string/null | 指标值。若暂无数据，可能返回 `null` |

---

### 核心指标列表（300+ 项，以下列出主要分类代表字段）

#### 资产负债表

| indicator | description |
| --- | --- |
| `currency_fund_stock` | 货币资金 |
| `settle_reserves_stock` | 结算备付金 |
| `lending_fund_stock` | 拆出资金 |
| `tradable_fnncl_assets_stock` | 交易性金融资产 |
| `derivative_fnncl_assets_stock` | 衍生金融资产 |
| `bill_receivable_stock` | 应收票据 |
| `account_receivable_stock` | 应收账款 |
| `receivable_financing_stock` | 应收款项融资 |
| `prepays_stock` | 预付款项 |
| `other_receivables_stock` | 其他应收款 |
| `inventory_stock` | 存货 |
| `contract_asset_stock` | 合同资产 |
| `total_current_assets_stock` | 流动资产合计 |
| `lt_equity_invest_stock` | 长期股权投资 |
| `invest_property_stock` | 投资性房地产 |
| `fixed_asset_stock` | 固定资产 |
| `construction_in_process_stock` | 在建工程 |
| `right_of_use_assets_stock` | 使用权资产 |
| `intangible_assets_stock` | 无形资产 |
| `goodwill_stock` | 商誉 |
| `dt_assets_stock` | 递延所得税资产 |
| `total_noncurrent_assets_stock` | 非流动资产合计 |
| `total_assets_stock` | 资产总计 |
| `st_borrow_stock` | 短期借款 |
| `bill_payable_stock` | 应付票据 |
| `accounts_payable_stock` | 应付账款 |
| `advance_payment_stock` | 预收款项 |
| `contract_liab_stock` | 合同负债 |
| `payroll_payable_stock` | 应付职工薪酬 |
| `tax_payable_stock` | 应交税费 |
| `other_payables_stock` | 其他应付款 |
| `noncurrent_liab_due_in1y_stock` | 一年内到期的非流动负债 |
| `other_current_liab_stock` | 其他流动负债 |
| `total_current_liab_stock` | 流动负债合计 |
| `lt_loan_stock` | 长期借款 |
| `bond_payable_stock` | 应付债券 |
| `lease_libilities_stock` | 租赁负债 |
| `estimated_liab_stock` | 预计负债 |
| `dt_liab_stock` | 递延所得税负债 |
| `total_noncurrent_liab_stock` | 非流动负债合计 |
| `total_liab_stock` | 负债合计 |
| `actual_received_capital_stock` | 实收资本 |
| `capital_reserve_stock` | 资本公积 |
| `earned_surplus_stock` | 盈余公积 |
| `undstrbtd_profit_stock` | 未分配利润 |
| `total_equity_atoopc_stock` | 归属于母公司所有者权益合计 |
| `minority_equity_stock` | 少数股东权益 |
| `total_owner_equity_stock` | 所有者权益合计 |
| `total_liab_and_owner_equity_stock` | 负债和所有者权益总计 |

#### 利润表

| indicator | description |
| --- | --- |
| `operating_total_revenue_stock` | 营业总收入 |
| `revenue_stock` | 营业收入 |
| `operating_total_cost_stock` | 营业总成本 |
| `operating_cost_stock` | 营业成本 |
| `operating_taxes_and_surcharge_stock` | 税金及附加 |
| `sales_fee_stock` | 销售费用 |
| `manage_fee_stock` | 管理费用 |
| `rad_cost_sum_stock` | 研发费用 |
| `financing_expenses_stock` | 财务费用 |
| `asset_impairment_loss_stock` | 资产减值损失 |
| `credit_impairment_loss_stock` | 信用减值损失 |
| `fv_chg_income_stock` | 公允价值变动收益 |
| `invest_income_stock` | 投资收益 |
| `asset_disposal_gain_stock` | 资产处置收益 |
| `other_income_stock` | 其他收益 |
| `op_stock` | 营业利润 |
| `non_operating_income_stock` | 营业外收入 |
| `nonoperating_cost_stock` | 营业外支出 |
| `total_profit_stock` | 利润总额 |
| `income_tax_cost_stock` | 所得税费用 |
| `np_stock` | 净利润 |
| `np_atoopc_stock` | 归属于母公司所有者的净利润 |
| `minority_gal_stock` | 少数股东损益 |
| `basic_eps_stock` | 基本每股收益 |
| `dlt_earnings_per_share_stock` | 稀释每股收益 |
| `total_compre_income_stock` | 综合收益总额 |

#### 现金流量表

| indicator | description |
| --- | --- |
| `cash_received_of_sales_service_stock` | 销售商品、提供劳务收到的现金 |
| `refund_of_tax_and_levies_stock` | 收到的税费返还 |
| `cash_received_of_other_oa_stock` | 收到其他与经营活动有关的现金 |
| `sub_total_of_ci_from_oa_stock` | 经营活动现金流入小计 |
| `goods_buy_and_service_cash_pay_stock` | 购买商品、接受劳务支付的现金 |
| `cash_paid_to_staff_etc_stock` | 支付给职工以及为职工支付的现金 |
| `payments_of_all_taxes_stock` | 支付的各项税费 |
| `other_cash_paid_related_to_oa_stock` | 支付其他与经营活动有关的现金 |
| `sub_total_of_cos_from_oa_stock` | 经营活动现金流出小计 |
| `ncf_from_oa_stock` | 经营活动产生的现金流量净额 |
| `cash_received_of_dspsl_invest_stock` | 收回投资收到的现金 |
| `invest_income_cash_received_stock` | 取得投资收益收到的现金 |
| `sub_total_of_ci_from_ia_stock` | 投资活动现金流入小计 |
| `cash_paid_for_assets_stock` | 购建固定资产、无形资产和其他长期资产支付的现金 |
| `invest_paid_cash_stock` | 投资支付的现金 |
| `sub_total_of_cos_from_ia_stock` | 投资活动现金流出小计 |
| `ncf_from_ia_stock` | 投资活动产生的现金流量净额 |
| `cash_received_of_absorb_invest_stock` | 吸收投资收到的现金 |
| `cash_received_of_borrowing_stock` | 取得借款收到的现金 |
| `sub_total_of_ci_from_fa_stock` | 筹资活动现金流入小计 |
| `cash_pay_for_debt_stock` | 偿还债务支付的现金 |
| `cash_paid_of_distribution_stock` | 分配股利、利润或偿付利息支付的现金 |
| `sub_total_of_cos_from_fa_stock` | 筹资活动现金流出小计 |
| `ncf_from_fa_stock` | 筹资活动产生的现金流量净额 |
| `net_increase_in_cce_stock` | 现金及现金等价物净增加额 |
| `initial_cce_balance_stock` | 期初现金及现金等价物余额 |
| `final_balance_of_cce_stock` | 期末现金及现金等价物余额 |

#### 现金流量表补充资料

| indicator | description |
| --- | --- |
| `np_cfs_stock` | 净利润 |
| `asset_impairment_reserve_stock` | 资产减值准备 |
| `depreciation_etc_stock` | 固定资产折旧、油气资产折耗、生产性生物资产折旧 |
| `intangible_assets_amortized_stock` | 无形资产摊销 |
| `lt_deferred_expenses_amrtzt_stock` | 长期待摊费用摊销 |
| `loss_of_disposal_assets_stock` | 处置固定资产、无形资产和其他长期资产的损失 |
| `fixed_assets_scrap_loss_stock` | 固定资产报废损失 |
| `loss_from_fv_chg_stock` | 公允价值变动损失 |
| `finance_cost_cfs_stock` | 财务费用 |
| `invest_loss_stock` | 投资损失 |
| `dt_assets_decrease_stock` | 递延所得税资产减少 |
| `dt_liab_increase_stock` | 递延所得税负债增加 |
| `inventory_decrease_stock` | 存货的减少 |
| `operating_items_decrease_stock` | 经营性应收项目的减少 |
| `increase_of_operating_item_stock` | 经营性应付项目的增加 |
| `ncf_from_oa_im_stock` | 经营活动产生的现金流量净额 |
| `ending_balance_of_cash_stock` | 现金的期末余额 |
| `initial_balance_of_cash_stock` | 现金的期初余额 |

#### 单季度数据

| indicator | description |
| --- | --- |
| `sq_operating_total_revenue_stock` | 单季度.营业总收入 |
| `sq_revenue_stock` | 单季度.营业收入 |
| `sq_operating_total_cost_stock` | 单季度.营业总成本 |
| `sq_operating_cost_stock` | 单季度.营业成本 |
| `sq_sales_fee_stock` | 单季度.销售费用 |
| `sq_manage_fee_stock` | 单季度.管理费用 |
| `sq_rad_cost_sum_stock` | 单季度.研发费用 |
| `sq_finance_cost_stock` | 单季度.财务费用 |
| `sq_invest_income_stock` | 单季度.投资收益 |
| `sq_op_stock` | 单季度.营业利润 |
| `sq_total_profit_stock` | 单季度.利润总额 |
| `sq_income_tax_cost_stock` | 单季度.所得税费用 |
| `sq_np_stock` | 单季度.净利润 |
| `sq_np_atoopc_stock` | 单季度.归属于母公司所有者的净利润 |
| `sq_basic_eps_stock` | 单季度.基本每股收益 |
| `sq_ncf_from_oa_stock` | 单季度.经营活动产生的现金流量净额 |
| `sq_ncf_from_ia_stock` | 单季度.投资活动产生的现金流量净额 |
| `sq_ncf_from_fa_stock` | 单季度.筹资活动产生的现金流量净额 |
| `sq_net_increase_in_cce_stock` | 单季度.现金及现金等价物净增加额 |
| ...（其余单季度指标前缀均为 `sq_`） | 与非单季度字段一一对应 |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_stock_financial_data/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}

payload = {
    "stock_code": "300033.SZ",
    "date": "20260526",
    "indicators": [
        "currency_fund_stock",
        "settle_reserves_stock",
        "total_assets_stock",
        "sq_revenue_stock",
        "sq_np_stock",
        {
            "indicator": "sq_operating_total_cost_2_stock",
            "indiparams": ["100", "2025", "100"]
        }
    ]
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();

        String json = """
        {
          "stock_code": "300033.SZ",
          "date": "20260526",
          "indicators": [
            "currency_fund_stock",
            "settle_reserves_stock",
            "total_assets_stock",
            "sq_revenue_stock",
            "sq_np_stock",
            {
              "indicator": "sq_operating_total_cost_2_stock",
              "indiparams": ["100", "2025", "100"]
            }
          ]
        }
        """;

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.wanxingai.com/openapi/get_stock_financial_data/"))
            .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
curl -X POST https://api.wanxingai.com/openapi/get_stock_financial_data/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{
    "stock_code": "300033.SZ",
    "date": "20260526",
    "indicators": [
      "currency_fund_stock",
      "settle_reserves_stock",
      "total_assets_stock",
      "sq_revenue_stock",
      "sq_np_stock",
      {
        "indicator": "sq_operating_total_cost_2_stock",
        "indiparams": ["100", "2025", "100"]
      }
    ]
  }'
```

### 注意事项

1. 接口支持 300+ 项财务指标，用户可通过 `indicators` 参数按需查询
2. `indicators` 为必填参数，至少传入一个指标
3. 普通财报指标默认使用最近报告期参数，例如 `["20260331", "100"]`
4. 单季度指标，即 `sq_` 开头的指标，默认使用当前查询日期参数，例如 `["20260526", "100"]`
5. 如果某个指标需要特殊参数，可以使用对象形式传入 `indiparams`，系统会按传入参数查询
6. `date` 不传时默认当天
7. `unit` 不传时默认 `100`
8. 返回结果中的 `indicator` 为开放平台指标名

---

# 高级功能

---

# 智能选股

> 智能选股功能

## 接口基本信息

- **接口名称**: `smart_stock_picking`
- **功能描述**: 智能选股——用自然语言描述选股条件，返回符合条件的证券列表
- **数据更新频率**: 实时
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/smart_stock_picking/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `searchstring` | str | **是** | — | 自然语言选股描述 | `近一个月涨幅最大的前5只A股` |
| `searchtype` | str | 否 | `"stock"` | 证券类型：`stock`/ `US_stock`/ `index`/ `NEEQ`/ `HK_stock`/ `fund` | `stock` |

---

### 返回数据说明

返回 JSON 数组，每个元素包含 `table` 对象：

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `table.股票代码` | array[str] | 标准股票代码 |
| `table.股票简称` | array[str] | 股票简称 |
| `table.股票市场类型` | array[str] | 所属市场，如 a股 |
| `table.区间涨跌幅:前复权[YYYYMMDD-YYYYMMDD]` | array[float] | 指定区间涨跌幅（%），字段名包含日期区间 |
| `table.区间涨跌幅:前复权排名[YYYYMMDD-YYYYMMDD]` | array[str] | 排名，格式 "名次/总数"，如 "1/5516" |
| `table.区间涨跌幅:前复权排名名次[YYYYMMDD-YYYYMMDD]` | array[int] | 排名名次数字 |
| `table.区间涨跌幅:前复权排名基数[YYYYMMDD-YYYYMMDD]` | array[int] | 排名总基数 |

---

### 支持的选股条件类型

| 类型 | 示例描述 |
| --- | --- |
| 涨幅条件 | 近一个月涨幅超过 20% 的科技股 |
| 估值条件 | 市盈率低于 20 的低估值股票 |
| 财务条件 | ROE 大于 15% 的优质股票 |
| 市值条件 | 市值超过 1000 亿的大盘股 |
| 行业条件 | 新能源行业的龙头股 |
| 技术条件 | 突破 60 日均线的股票 |
| 资金条件 | 北向资金大幅流入的股票 |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/smart_stock_picking/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "searchstring": "个股热度最高的前10只A股",
    "searchtype": "stock"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = "{
     "searchstring": "个股热度最高的前10只A股",
     "searchtype": "stock"
}";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/smart_stock_picking/"))
    .header("Content-Type", "application/json")
    .header("Authorization", "Bearer sk-********")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

```curl
curl -X POST https://api.wanxingai.com/openapi/smart_stock_picking/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"searchstring": "个股热度最高的前10只A股", "searchtype": "stock"}'
```

### 注意事项

1. table 字段名包含**动态日期区间**后缀，使用时需注意解析字段名以获取具体日期范围
2. 返回字段随 searchstring 变化而动态变化

---

# 公告查询

> 查询公告信息

## 接口基本信息

- **接口名称**: `query_announcement`
- **功能描述**: 查询上市公司公告
- **数据更新频率**: 实时更新
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/query_announcement/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `codes` | str | **是** | — | 证券代码，英文逗号分隔；若按板块查询可传空字符串，并通过 mode 指定板块 | `600519.SH` |
| `outputpara` | str | **是** | — | 输出字段（格式 `"字段名:Y"`），如 `"code:Y,secname:Y,reportType:Y,title:Y,publishDate:Y"` | `code:Y,secname:Y,title:Y,publishDate:Y` |
| `report_type` | str | 否 | `"903"` | 公告类型：`"903"`-全部 / `"901002004"`-上市公告书 等 | `903` |
| `begin_date` | str | 否 | `""` | 公告开始日期，格式 YYYY-MM-DD | `2026-01-01` |
| `end_date` | str | 否 | `""` | 公告截止日期，格式 YYYY-MM-DD | `2026-04-17` |
| `mode` | str | 否 | `""` | 按板块提取：`"allAStock"`-全部A股 / `"allBond"`-全部债券 | `allAStock` |

---

### 支持的 outputpara 字段

| 字段名 | 中文含义 |
| --- | --- |
| `code:Y` | 标准股票代码 |
| `secname:Y` | 证券简称 |
| `reportType:Y` | 公告类型代码 |
| `title:Y` | 公告标题 |
| `publishDate:Y` | 公告发布日期，格式 YYYY-MM-DD |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `code` | str | 标准股票代码 |
| `secname` | str | 证券简称 |
| `reportType` | str | 公告类型代码 |
| `title` | str | 公告标题 |
| `publishDate` | str | 公告发布日期，格式 YYYY-MM-DD |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/query_announcement/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "codes": "600519.SH",
    "outputpara": "code:Y,secname:Y,title:Y,publishDate:Y"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = "{
     "codes": "600519.SH",
     "outputpara": "code:Y,secname:Y,title:Y,publishDate:Y"
}";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/query_announcement/"))
    .header("Content-Type", "application/json")
    .header("Authorization", "Bearer sk-********")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

```curl
curl -X POST https://api.wanxingai.com/openapi/query_announcement/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"codes": "600519.SH", "outputpara": "code:Y,secname:Y,title:Y,publishDate:Y"}'
```

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `stock_code` | str | **是** | — | 完整股票代码，需带交易所后缀，多个用英文逗号分隔 | `600519.SH` |
| `date` | str | 否 | `""` | 查询日期，格式 YYYY-MM-DD；不传则默认使用今天日期 | `2026-04-17` |

---

### 返回数据说明

返回 JSON 数组，格式为 `[{code, query_date, data: [{indicator, description, value}]}]`

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `code` | str | 标准股票代码 |
| `query_date` | str | 实际查询日期 |
| `data` | array[object] | 指标数组，每项含 indicator（英文名）、description（中文名）、value（指标值） |

---

### 完整指标列表（共 75 项）

#### 涨跌统计类（17项）

| indicator | description |
| --- | --- |
| `up_days_stock` | 连涨天数 |
| `down_days_stock` | 连跌天数 |
| `his_high_stock` | 创历史新高 |
| `his_low_stock` | 创历史新低 |
| `phase_high_stock` | 创阶段新高 |
| `phase_low_stock` | 创阶段新低 |
| `up_valid_break_ma_stock` | 向上有效突破均线 |
| `down_valid_break_ma_stock` | 向下有效突破均线 |
| `up_open_date_stock` | 涨停打开日 |
| `dl_open_date_stock` | 跌停打开日 |
| `long_or_short_by_avg_line_stock` | 均线多空头排列看涨看跌 |
| `maxup_nd_stock` | N天M板 |
| `his_high_nearly_days_stock` | 近期创历史新高次数 |
| `his_low_nearly_days_stock` | 近期创历史新低次数 |
| `dptb_stock` | DPTB大盘同步指标 |
| `jdqs_stock` | JDQS阶段强势指标 |
| `jdrs_stock` | JDRS阶段弱势指标 |

#### 量价类指标（10项）

| indicator | description |
| --- | --- |
| `vol_ratio_stock` | 量比 |
| `tapi_stock` | TAPI加权指数成交值 |
| `vma_stock` | VMA量简单移动平均 |
| `vmacd_stock` | VMACD量指数平滑异同平均 |
| `vosc_stock` | VOSC成交量震荡 |
| `vstd_stock` | VSTD成交量标准差 |
| `obv_stock` | OBV能量潮 |
| `pvt_stock` | PVT量价趋势指标 |
| `wvad_stock` | WVAD威廉变异离散量 |
| `mfi_stock` | MFI资金流向指标 |

#### 人气意愿类指标（5项）

| indicator | description |
| --- | --- |
| `cr_stock` | CR能量指标 |
| `psy_stock` | PSY心理指标 |
| `vr_stock` | VR成交量比率 |
| `arbr_stock` | 人气意愿指标(ARBR) |
| `wad_stock` | WAD威廉聚散指标 |

#### 趋势类指标（14项）

| indicator | description |
| --- | --- |
| `bbi_stock` | BBI多空指数 |
| `ddi_stock` | DDI方向标准差偏离指数 |
| `dma_stock` | DMA平均线差 |
| `ma_stock` | MA简单移动平均 |
| `expma_stock` | EXPMA指数平均数 |
| `macd_stock` | MACD指数平滑异同平均 |
| `mtm_stock` | MTM动力指标 |
| `price_osc_stock` | PRICEOSC价格振荡指标 |
| `trix_stock` | TRIX三重指数平滑平均 |
| `ddzbczq_stock` | 顶底指标(长周期) |
| `ddzbzzq_stock` | 顶底指标(中周期) |
| `mi_stock` | MI动量指标 |
| `micd_stock` | MICD异同离差动力指数 |
| `rc_stock` | RC变化率指数 |

#### 摆动类指标（16项）

| indicator | description |
| --- | --- |
| `bias_stock` | BIAS乖离率 |
| `cci_stock` | CCI顺势指标 |
| `dbcd_stock` | DBCD异同离差乖离率 |
| `dpo_stock` | DPO区间震荡线 |
| `kdj_stock` | KDJ随机指标 |
| `lwr_stock` | LWR威廉指标 |
| `roc_stock` | ROC变动速率 |
| `rsi_stock` | RSI相对强弱指标 |
| `si_stock` | SI摆动指标 |
| `srdm_stock` | SRDM动向速度比率 |
| `vroc_stock` | VROC量变动速率 |
| `vrsi_stock` | VRSI量相对强弱 |
| `wr_stock` | WR威廉指标 |
| `b3612_stock` | B3612三减六日乖离 |
| `adtm_stock` | ADTM动态买卖气指标 |
| `skdj_stock` | SKDJ慢速随机指标 |

#### 通道/包络类指标（6项）

| indicator | description |
| --- | --- |
| `bbiboll_stock` | BBIBOLL多空布林线 |
| `boll_stock` | BOLL布林线 |
| `cdp_stock` | CDP逆势操作 |
| `sar_stock` | SAR抛物转向指标 |
| `env_stock` | ENV指标 |
| `mike_stock` | MIKE麦克指标 |

#### 波动率/其他指标（7项）

| indicator | description |
| --- | --- |
| `zdzb_stock` | ZDZB筑底指标 |
| `rccd_stock` | RCCD异同离差变化率指数 |
| `srmi_stock` | SRMI(MI修正指标) |
| `atr_stock` | ATR真实波幅 |
| `cvlt_stock` | CVLT佳庆离散指标 |
| `mass_stock` | MASS梅斯线 |
| `std_stock` | STD标准差 |
| `vhf_stock` | VHF纵横指标 |

---

---

# 金融搜索

> 支持关键词、指定域名和时间范围的金融网页搜索

## 接口基本信息

- **接口名称**: `web_search`
- **功能描述**: 金融搜索接口，支持按关键词、指定域名、时间范围和语言区域检索网页结果。可不传关键词，仅根据指定域名检索内容。
- **数据更新频率**: 实时
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/v1/web-search/`
- **认证方式**: 请求头携带 `Authorization: Bearer sk-********`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `query` | str | 否 | — | 搜索关键词。可不传关键词，仅根据 `domains` 指定的网站检索内容 | `英伟达 财报 资本开支` |
| `domains` | str | 否 | `""` | 指定检索域名，多个域名用英文逗号分隔 | `sec.gov,nvidia.com` |
| `freshness` | str | 否 | `""` | 时间范围。支持 `oneday`、`oneweek`、`onemonth`、`oneyear`，也支持 `开始时间..结束时间` 自定义范围 | `oneweek` |
| `count` | int | 否 | `10` | 返回结果数量 | `10` |
| `market` | str | 否 | `zh-CN` | 市场区域 | `zh-CN` |
| `set_lang` | str | 否 | `zh` | 返回语言 | `zh` |

---

### freshness 自定义时间示例

```
{
  "freshness": "2020-08-05 18:50:00..2020-08-07 21:52:00"
}
```

---

### 返回数据说明

返回 JSON 对象，格式为 `{"status": 状态码, "message": 结果数据}`；请求失败时返回 `{"status": 状态码, "error": 错误信息}`。

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `status` | int | 状态码。`200` 表示成功 |
| `message` | array/object | 搜索结果数据，具体结构以实际返回为准 |
| `error` | str | 错误信息，仅失败时返回 |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/v1/web-search/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "query": "英伟达 财报 资本开支",
    "domains": "sec.gov,nvidia.com",
    "freshness": "oneweek",
    "count": 10,
    "market": "zh-CN",
    "set_lang": "zh"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();

        String json = """
        {
          "query": "英伟达 财报 资本开支",
          "domains": "sec.gov,nvidia.com",
          "freshness": "oneweek",
          "count": 10,
          "market": "zh-CN",
          "set_lang": "zh"
        }
        """;

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.wanxingai.com/v1/web-search/"))
            .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
curl -X POST https://api.wanxingai.com/v1/web-search/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{
    "query": "英伟达 财报 资本开支",
    "domains": "sec.gov,nvidia.com",
    "freshness": "oneweek",
    "count": 10,
    "market": "zh-CN",
    "set_lang": "zh"
  }'
```

### 注意事项

1. `query` 非必填；当只需要检索指定网站时，可以只传 `domains`
2. `domains` 多个域名用英文逗号分隔，不需要带 `https://`
3. `freshness` 为空时不限制时间范围；自定义时间范围使用 `开始时间..结束时间` 格式
4. 接口需要鉴权，请在请求头中传入有效 API Key

---

# 宏观经济数据

---

# 自然语言匹配宏观指标

> 通过自然语言找到唯一匹配的公开宏观指标编号

## 接口基本信息

- **接口名称**: `match_edb_displayid`
- **功能描述**: 根据自然语言问题匹配唯一且最相关的宏观经济指标，返回可用于数据查询的公开 `displayid`
- **数据更新频率**: 随宏观指标库更新
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/edb/match_displayid/`
- **认证方式**: `Authorization: Bearer sk-********`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `query` | str | **是** | — | 需要查询的完整自然语言问题 | `2025年乡村水电站的个数` |
| `count` | int | 否 | `5` | 参与筛选的候选数量，范围为 1–20 | `5` |

---

### 返回数据说明

成功时返回 `status=200`。指标编号统一为 `WX` 开头并跟随 9 位数字，例如 `WX567563093`。

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `status` | int | 业务状态码，`200` 表示成功 |
| `message.query` | str | 用户提交的原始问题 |
| `message.keyword_split` | str | 用于向量检索的精简关键词 |
| `message.count` | int | 检索到的候选数量 |
| `message.chosen` | object/null | 最终选中项，包含名称和公开编号 |
| `message.candidates` | array | 候选列表，每项包含名称、公开编号、频率和单位 |
| `error` | str | 失败原因，仅失败时返回 |

### 返回示例

```
{
  "status": 200,
  "message": {
    "query": "上海水电站个数",
    "keyword_split": "上海 水电站 个数",
    "count": 5,
    "chosen": {
      "name": "上海:乡村办水电站个数",
      "displayid": "WX843901243"
    },
    "candidates": [
      {
        "name": "上海:乡村办水电站个数",
        "displayid": "WX843901243",
        "frequency": "Y",
        "unit": "个"
      },
      {
        "name": "上海:城市供水(公共供水):水厂个数",
        "displayid": "WX095121532",
        "frequency": "Y",
        "unit": "个"
      },
      {
        "name": "上海:建制镇:污水处理厂个数",
        "displayid": "WX252670802",
        "frequency": "Y",
        "unit": "个"
      },
      {
        "name": "江苏省:乡村办水电站个数",
        "displayid": "WX504295528",
        "frequency": "Y",
        "unit": "个"
      },
      {
        "name": "上海:乡:污水处理厂个数",
        "displayid": "WX479373714",
        "frequency": "Y",
        "unit": "个"
      }
    ]
  }
}
```

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/edb/match_displayid/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "query": "2025年乡村水电站的个数",
    "count": 5
}

resp = requests.post(url, json=payload, headers=headers)
resp.raise_for_status()
result = resp.json()
print(result["message"]["chosen"]["displayid"])
```

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {
      "query": "2025年乡村水电站的个数",
      "count": 5
    }
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/edb/match_displayid/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/edb/match_displayid/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{
    "query": "2025年乡村水电站的个数",
    "count": 5
  }'
```

### 注意事项

1. 建议传入包含地区、指标含义、统计口径和时间信息的完整问题
2. `displayid` 格式固定为 `WX` 加 9 位数字，不要自行修改或拼接
3. 该接口只匹配指标，不直接返回时间序列；请将返回编号传给“查询宏观指标数据”接口
4. 模型筛选和向量检索可能需要一定时间，请为 HTTP 客户端设置合理超时时间

---

# 查询宏观指标数据

> 通过 WX 指标编号查询指定日期范围的宏观时间序列

## 接口基本信息

- **接口名称**: `get_edb_data_by_displayid`
- **功能描述**: 使用公开 `displayid` 查询指定日期范围内的宏观经济指标时间序列
- **数据更新频率**: 取决于指标自身频率
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/edb/by_displayid/`
- **认证方式**: `Authorization: Bearer sk-********`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 描述 | 示例 |
| --- | --- | --- | --- | --- |
| `displayid` | str | **是** | 自然语言匹配接口返回的公开指标编号，格式为 `WX` 加 9 位数字 | `WX567563093` |
| `startdate` | str | **是** | 查询开始日期，格式为 `YYYY-MM-DD` | `2019-01-01` |
| `enddate` | str | **是** | 查询结束日期，格式为 `YYYY-MM-DD` | `2020-12-31` |

`indicators` 可作为 `displayid` 的兼容别名，但新接入建议统一使用 `displayid`。

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `status` | int | 业务状态码，`200` 表示请求成功 |
| `message.displayid` | str | 本次查询使用的公开指标编号 |
| `message.startdate` | str | 查询开始日期 |
| `message.enddate` | str | 查询结束日期 |
| `message.tables` | array | 指标时间序列表格；没有对应日期数据时仍可能成功返回空数组字段 |
| `tables[].id` | array | 公开指标编号数组，编号仍为 `WX` 格式 |
| `tables[].time` | array | 数据日期数组 |
| `tables[].value` | array | 指标值数组，与 `time` 按下标一一对应 |
| `tables[].rtime` | array | 数据更新时间数组，具体内容取决于上游数据 |
| `tables[].index_name` | array | 指标名称或附加描述数组 |
| `error` | str | 失败原因，仅失败时返回 |

### 返回示例

```
{
  "status": 200,
  "message": {
    "displayid": "WX567563093",
    "startdate": "2019-01-01",
    "enddate": "2020-12-31",
    "tables": [
      {
        "id": ["WX567563093"],
        "time": ["2020-12-31", "2019-12-31"],
        "value": ["43957.0", "45445.0"],
        "rtime": [],
        "index_name": []
      }
    ]
  }
}
```

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/edb/by_displayid/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {
    "displayid": "WX567563093",
    "startdate": "2019-01-01",
    "enddate": "2020-12-31"
}

resp = requests.post(url, json=payload, headers=headers)
resp.raise_for_status()
print(resp.json())
```

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {
      "displayid": "WX567563093",
      "startdate": "2019-01-01",
      "enddate": "2020-12-31"
    }
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/edb/by_displayid/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/edb/by_displayid/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{
    "displayid": "WX567563093",
    "startdate": "2019-01-01",
    "enddate": "2020-12-31"
  }'
```

### 注意事项

1. 该接口只接受 `WX` 加 9 位数字的公开编号，不能传入其他来源的原始指标编号
2. `startdate` 和 `enddate` 均为闭区间日期，且开始日期不能晚于结束日期
3. 指标发布频率可能是日、月、季或年；请求成功但 `time`、`value` 为空，表示该日期范围没有观测值
4. 建议先调用“自然语言匹配宏观指标”接口获取 `displayid`，再调用本接口查询数据

---

# 指数专题

---

# 指数历史行情

> 查询指数历史行情数据

## 接口基本信息

- **接口名称**: `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 | 振幅(%) |

---

## 使用示例

```python
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())
```

```java
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
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"}'
```

### 注意事项

1. datestr 不传则默认使用今天日期
2. 指数代码需含交易所后缀，如 000001.SH（上证指数）、399001.SZ（深证成指）

---

# 指数基本资料

> 查询指数基本资料信息

## 接口基本信息

- **接口名称**: `get_index_basic_info`
- **功能描述**: 查询指数基本资料信息（简称、全称、加权方式、发布机构等）
- **数据更新频率**: 静态数据
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_index_basic_info/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 描述 | 示例 |
| --- | --- | --- | --- | --- |
| `index_code` | str | **是** | 指数代码，多个用英文逗号分隔 | `000001.SH,399001.SZ` |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `code` | str | 指数代码 |
| `data` | array | 指标数组 |
| `index_short_name_index` | str | 指数简称 |
| `index_full_name_index` | str | 指数全称 |
| `index_introduction_index` | str | 指数简介 |
| `wgt_method_index` | str | 加权方式 |
| `index_code_index` | str | 指数代码 |
| `index_category_index` | str | 指数类别 |
| `publish_org_index` | str | 发布机构 |
| `trade_currency_index` | str | 交易币种 |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_index_basic_info/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {"index_code": "000001.SH,399001.SZ"}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"index_code": "000001.SH,399001.SZ"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_index_basic_info/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/get_index_basic_info/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{"index_code": "000001.SH,399001.SZ"}'
```

## 输入参数说明

| 参数名 | 类型 | 必选 | 描述 |
| --- | --- | --- | --- |
| 无参数 | | | |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `name` | str | 指数名称（如"上证指数"） |
| `code` | str | 指数代码（含交易所后缀，如 000001.SH） |

---

---

# 常用指数代码对照表

> 获取常用指数代码对照表

## 接口基本信息

- **接口名称**: `get_common_index_codes`
- **功能描述**: 获取常用指数代码对照表，覆盖A股、港股、美股主要指数
- **数据更新频率**: 静态数据
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_common_index_codes/`

---

---

### 返回数据说明

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| name | string | 指数名称 |
| code | string | 指数代码（含交易所后缀） |

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_common_index_codes/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}

resp = requests.post(url, json={}, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = "{}";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_common_index_codes/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/get_common_index_codes/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{}'
```

### 注意事项

1. 无需传入任何参数，直接调用即可获取全部常用指数代码
2. 覆盖 A 股主要指数、港股指数、美股指数

---

# 指数两融指标

> 查询指数两融指标数据

## 接口基本信息

- **接口名称**: `get_index_margin_trading`
- **功能描述**: 查询指数两融指标数据（融资买入额、融资偿还额、融资余额、融券卖出量）
- **数据更新频率**: 日频
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_index_margin_trading/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `index_code` | str | **是** | — | 指数代码，需含交易所后缀 | `000001.SH` |
| `datestr` | str | 否 | 今天 | 查询日期，格式 YYYY-MM-DD，不传则默认今天 | `2026-04-01` |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `code` | str | 指数代码 |
| `data` | array | 指标数组 |
| `margin_trading_sell_amt_index` | float | 融资买入额 |
| `margin_trading_repay_amt_index` | float | 融资偿还额 |
| `margin_trading_balance_index` | float | 融资余额 |
| `short_selling_sell_vol_index` | float | 融券卖出量 |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_index_margin_trading/"
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())
```

```java
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_margin_trading/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/get_index_margin_trading/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{"index_code": "000001.SH", "datestr": "2026-04-01"}'
```

### 注意事项

1. datestr 不传则默认使用今天日期
2. 融资余额反映市场杠杆资金规模

---

# 指数技术指标

> 查询指数技术指标数据

## 接口基本信息

- **接口名称**: `get_index_technical_indicators`
- **功能描述**: 查询指数技术指标数据（连涨/连跌天数、上涨/下跌成份个数、MACD、ATR、OBV 等）
- **数据更新频率**: 日频（每日收盘后更新）
- **请求方法**: `POST`
- **API 路径**: `https://api.wanxingai.com/openapi/get_index_technical_indicators/`

---

## 输入参数说明

| 参数名 | 类型 | 必选 | 默认值 | 描述 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `index_code` | str | **是** | — | 指数代码，需含交易所后缀 | `000001.SH` |
| `date` | str | 否 | 今天 | 查询日期，格式 YYYY-MM-DD，不传则默认今天 | `2026-04-20` |

---

### 返回数据说明

| 字段名 | 类型 | 描述 |
| --- | --- | --- |
| `code` | str | 指数代码 |
| `query_date` | str | 查询日期 |
| `data` | array | 指标数组 |
| `his_high_nearly_index` | bool | 近期创历史高点 |
| `his_low_nearly_index` | bool | 近期创历史低点 |
| `up_days_index` | int | 连涨天数 |
| `down_days_index` | int | 连跌天数 |
| `constituent_raise_number_index` | int | 上涨成份个数 |
| `constituent_fall_number_index` | int | 下跌成份个数 |
| `macd_index` | float | MACD |
| `atr_index` | float | ATR |
| `obv_index` | float | OBV |

---

## 使用示例

```python
import requests

url = "https://api.wanxingai.com/openapi/get_index_technical_indicators/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
payload = {"index_code": "000001.SH"}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
```

```java
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"index_code": "000001.SH"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/get_index_technical_indicators/"))
    .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
curl -X POST https://api.wanxingai.com/openapi/get_index_technical_indicators/ \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer sk-********" \\
  -d '{"index_code": "000001.SH"}'
```

### 注意事项

1. datestr 不传则默认使用今天日期
2. 连涨/连跌天数为 0 表示当天未形成连续趋势
3. MACD、ATR、OBV 在某些情况下可能返回 null
