申万行业分类
index_classify
按官方数据字典采集申万行业分类,保留字段及其原始单位。
字段字典
| 字段 | 类型 | 单位 | 说明 |
|---|---|---|---|
index_code | str | — | 指数代码 |
industry_name | str | — | 行业名称 |
parent_code | str | — | 父级代码 |
level | str | — | 行业层级 |
industry_code | str | — | 行业代码 |
is_pub | str | — | 是否发布了指数 |
src | str | — | 行业分类(SW申万) |
数据集定义
GET
/v1/datasets/index_classify读取一个数据集的字段字典和入库覆盖范围。
| 参数 | 位置 | 说明 |
|---|---|---|
dataset_id | path · 必填 | 已授权的数据集 ID,可从数据集列表获取。 |
调用示例
python -m financedb api-get --key-file ~/.config/financedb/key.json https://api.open.invstbot.com/v1/datasets/index_classify合成响应示例
{
"id": "index_classify",
"title": "申万行业分类",
"category": "指数专题",
"code_field": "index_code",
"date_field": null,
"row_count": 0,
"can_export": true,
"fields": [
{
"name": "index_code",
"type": "str",
"unit": null,
"description": "指数代码"
},
{
"name": "industry_name",
"type": "str",
"unit": null,
"description": "行业名称"
},
{
"name": "parent_code",
"type": "str",
"unit": null,
"description": "父级代码"
}
],
"key": []
}读取数据记录
GET
/v1/datasets/index_classify/rows查询当前数据库内的记录。有日期的记录按日期倒序排列,保留精度的十进制值可能以 JSON 字符串返回。
| 参数 | 位置 | 说明 |
|---|---|---|
dataset_id | path · 必填 | 已授权的数据集 ID,可从数据集列表获取。 |
code | query · 可选 | 按数据集代码字段精确匹配,最长 128 字符。发送前按 URL 规则编码。 |
fields | query · 可选 | 以逗号分隔的字段名,最长 4000 字符。字段须在当前数据集的字段字典中,省略时返回可见字段。 |
cursor | query · 可选 | 原样传入上一页的 next_cursor,并保留筛选条件、字段顺序及每页行数。第一页省略。 |
limit | query · 可选 | 每页记录数,范围 1 至 1000。 |
format | query · 可选 | json 返回分页对象,csv 下载本页并要求密钥具有 CSV 权限。分页游标通过 JSON 响应获取。 |
调用示例
python -m financedb api-get --key-file ~/.config/financedb/key.json 'https://api.open.invstbot.com/v1/datasets/index_classify/rows?limit=5&fields=index_code%2Cindustry_name%2Cparent_code'合成响应示例
{
"dataset_id": "index_classify",
"rows": [
{
"index_code": null,
"industry_name": null,
"parent_code": null
}
],
"fields": [
"index_code",
"industry_name",
"parent_code"
],
"next_cursor": null,
"page_count": 1
}