Skip to content
Back to skills

Cn Index

ASecurity

A股指数数据与申万行业分类。上证/深证指数行情、成分股权重、申万行业分类。 当用户询问"上证指数""深证成指""申万行业""成分股权重""指数行情"时触发。

  • 9 stars
  • 0 votes
  • 0 copies
  • 9 views
  • Added September 9, 2026
toolsbashapi

Works with

  • api

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add Undermybelt/hermes-skills --skill cn-index --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cn Index?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cn Index
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/undermybelt-cn-index/badge)](https://www.skillsdirectory.com/skills/undermybelt-cn-index)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cn-index
description: >
  A股指数数据与申万行业分类。上证/深证指数行情、成分股权重、申万行业分类。
  当用户询问"上证指数""深证成指""申万行业""成分股权重""指数行情"时触发。
user-invocable: true
metadata:
  openclaw: 1.0.0
  emoji: 📉
  install: |
    # OpenClaw

    cp -r skills/cn-index ~/.openclaw/skills/
---

# CN Index — A股指数 + 申万行业分类

> 所有接口均为 V2 版本(`/api/v2/...`)。

## Curl Setup

```bash
BASE="http://43.167.234.49:3101"
AUTH=(-H "X-API-Key: 123456" -H "Content-Type: application/json")
```

---

## 代码格式规则

| 规则 | 值 |
|------|-----|
| 参数名 | `tsCode`(日线/周线/月线/每日指标)、`indexCode`(成分股权重) |
| 代码格式 | **带交易所后缀** |
| 日期格式 | `YYYYMMDD` |

**常用指数代码**:

| 指数 | tsCode |
|------|--------|
| 上证指数 | `000001.SH` |
| 深证成指 | `399001.SZ` |
| 创业板指 | `399006.SZ` |
| 沪深300 | `000300.SH` |
| 中证500 | `000905.SH` |

---

## 端点详情

### GET /api/v2/cnstock/index/basic — 指数列表

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `market` | string | No | `SSE`(上交所), `SZSE`(深交所) |

### GET /api/v2/cnstock/index/daily — 指数日线

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tsCode` | string | **Yes** | 指数代码(如 `000001.SH`) |
| `startDate` | string | No | YYYYMMDD |
| `endDate` | string | No | YYYYMMDD |
| `limit` | int | No | 1-5000 (默认 100) |

### GET /api/v2/cnstock/index/weekly — 指数周线

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tsCode` | string | **Yes** | 指数代码 |
| `startDate` | string | No | YYYYMMDD |
| `endDate` | string | No | YYYYMMDD |
| `limit` | int | No | 1-5000 |

### GET /api/v2/cnstock/index/monthly — 指数月线

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tsCode` | string | **Yes** | 指数代码 |
| `startDate` | string | No | YYYYMMDD |
| `endDate` | string | No | YYYYMMDD |
| `limit` | int | No | 1-5000 |

### GET /api/v2/cnstock/index/daily-basic — 指数每日指标

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tsCode` | string | **Yes** | 指数代码 |
| `tradeDate` | string | No | YYYYMMDD |
| `startDate` | string | No | YYYYMMDD |
| `endDate` | string | No | YYYYMMDD |
| `limit` | int | No | 1-5000 |

### GET /api/v2/cnstock/index/weight — 成分股权重

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `indexCode` | string | **Yes** | 指数代码 |
| `tradeDate` | string | No | YYYYMMDD |
| `startDate` | string | No | YYYYMMDD |
| `endDate` | string | No | YYYYMMDD |
| `limit` | int | No | 1-5000 |

### GET /api/v2/cnstock/index/classify — 申万行业分类

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `src` | string | No | 来源 |
| `version` | string | No | 版本 |
| `limit` | int | No | 数量限制 |

---

## 调用示例

```bash
# 上证指数最近日线
curl -sS "${AUTH[@]}" "$BASE/api/v2/cnstock/index/daily?tsCode=000001.SH&limit=5"

# 多指数并行
curl -sS "${AUTH[@]}" "$BASE/api/v2/cnstock/index/daily?tsCode=000001.SH&limit=5" &
curl -sS "${AUTH[@]}" "$BASE/api/v2/cnstock/index/daily?tsCode=399001.SZ&limit=5" &
wait

# 指数列表
curl -sS "${AUTH[@]}" "$BASE/api/v2/cnstock/index/basic?market=SSE"

# 成分股权重
curl -sS "${AUTH[@]}" "$BASE/api/v2/cnstock/index/weight?indexCode=000001.SH&limit=100"

# 申万行业分类
curl -sS "${AUTH[@]}" "$BASE/api/v2/cnstock/index/classify"

# 指数日线 + 每日指标并行
curl -sS "${AUTH[@]}" "$BASE/api/v2/cnstock/index/daily?tsCode=000001.SH&limit=10" &
curl -sS "${AUTH[@]}" "$BASE/api/v2/cnstock/index/daily-basic?tsCode=000001.SH&limit=10" &
wait
```

---

## 错误排查

| 错误 | 原因 | 修复 |
|------|------|------|
| 404 | 指数代码错误 | 检查 tsCode,如 `000001.SH` |
| 空数据 | `tsCode` / `indexCode` 混用 | `index/weight` 用 `indexCode`,其余用 `tsCode` |

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.