# 指数技术指标

> 查询指数技术指标数据

## 接口基本信息

- **接口名称**: `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
