
# Restful API
https://tsanghi.com/api/fin/index/{country_code}/constituent?token={token}&ticker={ticker}
指定国家或地区,获取相应指数的成分股。目前,已经覆盖全球30+国家/地区,收录的指数数量超500只。
更新时间:收盘后3~4小时。(不同市场有所不同)
更新周期:每天。
请求方式:GET。
# 示例:测试JSON
https://tsanghi.com/api/fin/index/CHN/constituent?token=demo&ticker=000001
# 示例:测试CSV
https://tsanghi.com/api/fin/index/CHN/constituent?token=demo&ticker=000001&fmt=csv
注:测试返回不超过10条数据(2年历史)
Request请求参数
参数名称 | 参数类型 | 参数选项 | 参数说明 |
token | 字符串 | 必选 | API Token。登录后获取。 |
country_code | 字符串 | 必选 | 国家/地区代码。详见国家/地区接口。 例如:CHN(中国)、USA(美国)。 |
ticker | 字符串 | 必选 | 指数代码。例如:000001(上证指数)。 |
fmt | 字符串 | 可选 | 输出格式。支持json和csv两种标准输出格式,默认:json。 |
columns | 字符串 | 可选 | 输出字段。支持自定义输出,多个字段以半角逗号分隔,默认:所有字段。 |
Response响应参数
参数名称 | 参数类型 | 参数说明 |
ticker | 字符串 | 指数代码 |
constituent | 字符串 | 成分股 |
Python示例
import requests
url = f"https://tsanghi.com/api/fin/index/CHN/constituent?token=demo&ticker=000001"
data = requests.get(url).json()
print(data)
Response示例
{
"msg": "操作成功",
"code": 200,
"data": [
{
"ticker": "000001",
"constituent": "600027"
},
{
"ticker": "000001",
"constituent": "600095"
}
]
}
更多详情:tsanghi.com