跳转至

index_latest — 各指数最新日线

每个可见指数在当前权限和时效内的最新一条日线。字段与 index_daily 相同,适合首页和「现在各指数是多少」这类查询。

  • 接口:index_latest
  • 权限要求:scope index:read
  • 更新频率:报价导入并重算日线之后,下一次查询即可见
  • 时效限制:有。与 index_daily 相同。免费用户默认只能看到延迟后的最近一条,专业会员与管理员看到最新已发布的一条。

输入参数

名称 类型 必选 描述
index_code str N 指数代码,如 Server_Index。省略时每个可见指数返回一条

没有 trade_date、start_date、end_date。要查历史区间用 index_daily。

输出参数

名称 类型 描述
trade_date str 该指数在权限范围内的最新交易日,YYYYMMDD
index_code str 指数代码
weighted_price str(decimal) 整体加权价格。网站身份下,非 aggregate 指数此值为空;API Key 具备 index:read 时返回数值
index_value str(decimal) 当日指数点位
previous_price str(decimal)/null 上一可计算报价日的整体价格。网站身份下的裁剪规则与 weighted_price 相同
previous_index str(decimal)/null 上一可计算报价日的指数点位
change_rate str(decimal) 涨跌比例,"0.0123" 表示 1.23%
calculated_at str 计算时间,RFC 3339

默认字段与 index_daily 相同。结果按指数的 sort_no, index_code 排列,但 sort_no 本身不在本数据集的输出列里。没有日线的指数不会出现在结果中。

谁能看到哪些指数

与 接口总览 的身份规则一致:

  • 不带 Key:已启用、非 private 的指数。免费访客不含 member。index_only 仍返回点位,加权价格为空。
  • 带 API Key:按 scope、指数范围和会员时效返回完整字段。免费 Key 指定 Hardware_Index 返回 403;省略代码时自动排除会员指数。

接口使用

1
2
3
4
5
import tokease

client = tokease.Client()
latest = client.index_latest()
one = client.index_latest(index_code="Server_Index")

cURL 示例

1
2
3
4
5
6
7
curl -X POST "https://your-domain/api/v1/query" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $TOKEASE_API_KEY" \
  -d '{
    "api_name": "index_latest",
    "fields": ["trade_date", "index_code", "index_value", "change_rate"]
  }'

相关页面