跳转至

index_basic — 指数基本信息

获取指数基础信息,包括指数代码、名称、基准日期与点位、公开范围等。

  • 接口index_basic
  • 数据示例:见下文
  • 权限要求:scope index:read
  • 更新频率:随后台指数管理实时更新
  • 时效限制:无(不受行情延迟限制)

输入参数

名称 类型 必选 描述
index_code str N 指数代码,精确匹配,如 Server_Index

所有参数均可省略;省略时分页返回当前 Key 有权访问的全部指数。

输出参数

名称 类型 描述
index_code str 唯一指数代码,例如 Server_Index
index_name str 指数中文名称,例如 AI 服务器售价指数
description str 指数说明;未填写时为 ""
base_date str/null 基准日期,YYYYMMDD;基准日期是元数据,不单独生成日数据
base_value str(decimal) 基准点位,例如 "1000.000000"
visibility str 公开范围:private(不公开)/ index_only(仅公开点位)/ aggregate(公开点位与整体价格)/ member(仅会员与管理员)
sort_no int 展示顺序,升序。与后台「指数管理」的排序列相同
enabled bool 是否启用

默认字段(省略 fields 时返回全部):

[
  "index_code",
  "index_name",
  "description",
  "base_date",
  "base_value",
  "visibility",
  "sort_no",
  "enabled"
]

接口使用

1
2
3
4
5
6
7
8
9
import tokease

pro = tokease.Client()

# 查询全部可用指数
df = pro.query("index_basic")

# 查询单个指数
df = pro.query("index_basic", params={"index_code": "Server_Index"})

数据样例

index_code index_name base_date base_value visibility enabled
Server_Index AI 服务器售价指数 1000.000000 aggregate true
Server_Rental_Index AI 服务器租赁指数 1000.000000 aggregate true
GPU_Index 算力卡指数 1000.000000 index_only true
DRAM_Index 内存指数 1000.000000 index_only true
SSD_Index 固态存储指数 1000.000000 index_only true
CPU_Index 处理器指数 1000.000000 index_only true
OI_Index 光互联指数 1000.000000 index_only true
Hardware_Index 算力硬件指数 1000.000000 member true

系统内置 7 个可维护的基础指数(含 AI 服务器售价与租赁两个独立报价组)和 1 个会员指数 Hardware_Index,共 8 个指数系列。 免费用户的 index_basic 结果不包含 member 可见性的指数(当前即 Hardware_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: $WHALE_KEY" \
  -d '{
    "api_name": "index_basic",
    "fields": ["index_code", "index_name", "base_value", "visibility"]
  }'

响应:

{
  "request_id": "req_01J5KR0A2B4C6D8E0F2H4J6L8N",
  "code": 0,
  "message": "ok",
  "data": {
    "fields": ["index_code", "index_name", "base_value", "visibility"],
    "items": [
      ["Server_Index", "AI 服务器售价指数", "1000.000000", "aggregate"],
      ["Server_Rental_Index", "AI 服务器租赁指数", "1000.000000", "aggregate"],
      ["GPU_Index", "算力卡指数", "1000.000000", "index_only"],
      ["DRAM_Index", "内存指数", "1000.000000", "index_only"]
    ],
    "limit": 1000,
    "offset": 0,
    "returned": 4,
    "has_more": false
  }
}

相关页面