跳转至

← 返回接口目录

7709-批量快照

作用

按指定代码列表查询当前行情,返回现价、涨跌幅、成交量额、内外盘和一档盘口(买一、卖一)。

项目 内容
主要调用 client.quotes.get_snapshots(codes)
底层接口 0x054c
返回模型 list[QuoteSnapshot]

这个方法按给定代码列表返回当前行情快照。涨幅榜、成交额榜这类服务端排序列表使用 7709-分类行情.md。

接口选择

需求 调用
当前行情和买一、卖一 client.quotes.get_snapshots()
当前行情和完整五档 client.helpers.full_quotes()
五档增量刷新和推送 增量刷新 / 推送队列
旧版五档快照和交易状态 client.quotes.legacy()

示例

from eltdx import TdxClient

with TdxClient(timeout=3) as client:
    quotes = client.quotes.get_snapshots(["sz000001", "sh600000"])
    quote = quotes[0]
    print(quote.last_price, quote.change_pct)

真实返回样本

返回 list[QuoteSnapshot]。下面是 to_jsonable(quotes)[0] 的常用字段节选。

真实返回 JSON · QuoteSnapshot(1 条节选)

采样标的sz000001
采样时间2026-08-17 盘中
返回类型list[QuoteSnapshot]

真实采样;批量返回结构相同,这里只展示第一只股票。

{
  "exchange": "sz",
  "market_id": 0,
  "code": "000001",
  "last_price": 11.11,
  "pre_close_price": 11.11,
  "open_price": 11.2,
  "high_price": 11.22,
  "low_price": 11.07,
  "total_hand": 810447,
  "current_hand": 72,
  "amount": 900265344.0,
  "inside_dish": 420988,
  "outer_disc": 389460,
  "open_amount_yuan": 23573800.0,
  "buy_levels": [
    {"price": 11.1, "volume": 209, "price_delta_raw": -1}
  ],
  "sell_levels": [
    {"price": 11.11, "volume": 7836, "price_delta_raw": 0}
  ]
}

参数

参数 含义
codes 单个代码或代码列表,支持 sz000001、000001 这类写法;没有市场前缀时会按代码段补全

盘口返回买一、卖一。需要完整五档时,使用 client.helpers.full_quotes()。

解析字段

QuoteSnapshot 字段 含义
exchange 市场前缀,sz / sh / bj
market_id 市场编号,0=sz、1=sh、2=bj
code 六位代码
full_code 完整代码,exchange + code
active1 活跃序号 / 状态序号,原样保留
last_price 最新价 / 现价
pre_close_price 昨收价
open_price 今开价
high_price 最高价
low_price 最低价
time_raw 行情时间原始值
unknown_after_time_raw 时间后保留字段,原样保留
total_hand 总成交量,单位手
current_hand 现手
amount 成交额
amount_raw 成交额 compact-float 原始值
inside_dish 内盘,单位手
outer_disc 外盘,单位手
unknown_after_outer_raw 外盘后保留字段,原样保留
open_amount_raw 开盘金额原始值
open_amount_yuan 开盘金额,单位元
buy_levels / sell_levels 买一 / 卖一盘口
tail_raw 尾部扩展原始字段

buy_levels / sell_levels 单档是 QuoteLevel:

QuoteLevel 字段 含义
price 档位价格
volume 档位挂单量,单位手
price_delta_raw 相对现价的价格差分原始值

派生字段

字段 计算方式
change last_price - pre_close_price
change_pct change / pre_close_price * 100
sum_buy_vol 返回的买盘档位挂单量合计
sum_sell_vol 返回的卖盘档位挂单量合计

使用建议

场景 建议
查询完整行情和五档盘口 用 client.helpers.full_quotes(...)
只调用原生基础快照 用 client.quotes.get_snapshots(...)
直接操作五档刷新或推送 用 client.quotes.get_depth() / refresh()
查涨幅榜 / 成交额榜 用 client.quotes.list_by_category()
实时连续刷新可见代码 先用快照初始化,再配合 client.quotes.refresh()

0x054c 返回的是当前行情快照,不包含分时曲线、成交明细、K 线历史。那些数据分别用分时、成交明细和 K 线方法取。