跳转至

L2 行情快照(含十档盘口)

来源同步:/Users/mac/Projects/chatgpt-codex/doc/api_Quotes.md

所属接口集:股票行情

请求 URL

GET /v1/api/quotes/l2/snapshot

认证方式

Bearer Token(详见 认证与签名

接口概述

获取指定股票的 L2 行情快照数据,并在每条记录中附加十档买卖盘口(_ob10 字段)。基础数据来源于 TDX 实时行情,盘口数据从 TDX 解码的 frames 二进制文件中提取。

请求参数

Query 参数:

参数 类型 必填 默认值 说明
codes string - 股票代码,逗号分隔,如 600000,000001
code string - codes,单个或逗号分隔
sort string pct_chg 排序字段,可选 changepct_chgvolamount
order string desc 排序方向,可选 ascdesc

接口说明

  • 基础数据与 /quotes/snapshot 相同,来源标记为 source: "tdx"
  • 每条记录尝试从本地 frames_<code>.binframes.bin 文件中解码十档盘口。
  • 解码成功时附加 _ob10 字段,包含 buy(买一到买十)、sell(卖一到卖十)、sourcets
  • 解码失败时 _ob10 字段不出现。

响应格式示例

{
  "code": 1,
  "message": "success",
  "data": [
    {
      "ts_code": "600000.SH",
      "code": "600000",
      "name": "浦发银行",
      "close": 10.25,
      "pct_chg": 1.49,
      "source": "tdx",
      "market": "SH",
      "_ob10": {
        "buy": [
          {"price": 10.24, "volume": 500},
          {"price": 10.23, "volume": 320}
        ],
        "sell": [
          {"price": 10.26, "volume": 200},
          {"price": 10.27, "volume": 150}
        ],
        "source": "tdx",
        "ts": 1723968000
      }
    }
  ]
}

返回状态

状态码 说明
200 成功
400 参数错误(无效排序字段或排序方向)
401 未认证
403 无权限
503 TDX 连接失败