← 返回接口目录
7709-增量刷新推送队列
作用
发起一次行情增量刷新请求,并读取 transport 收到的未配对推送帧。
| 项目 |
内容 |
| 行情刷新 |
client.quotes.refresh(...) |
| 读取推送 |
client.quotes.poll_push(...) |
| 清空队列 |
client.quotes.drain_pushes(...) |
| 底层接口 |
0x0547 |
| 返回模型 |
QuoteRefreshPage 或推送帧 |
与 0x054c、0x053e 的区别
0x0547 的核心定位是按代码和游标刷新行情。首次游标通常为 0,所以返回内容可能看起来像完整快照;后续调用才体现增量刷新语义。
- 它不是
0x054c:0x054c 不带游标,只负责一次性建立基础快照,实盘稳定确认一档盘口。
- 它不是
0x053e:0x053e 每次都重新查询旧版完整快照,不支持游标刷新,也不承担推送队列语义。
0x0547 返回 QuoteRefreshPage / QuoteRefreshRecord;0x053e 返回 LegacyQuote,两者的二进制布局和解析器不能互换。
示例
from eltdx import TdxClient
with TdxClient(timeout=3) as client:
depth = client.get_quote_depth(["sz000001", "sh600000"])
page = client.quotes.refresh(["sz000001"], cursors={"sz000001": 0})
frame = client.quotes.poll_push(timeout=0.5)
frames = client.quotes.drain_pushes()
解析推送帧:
frame = client.quotes.poll_push(timeout=0.5, parse=True)
frames = client.quotes.drain_pushes(parse=True)
参数
| 参数 |
含义 |
codes |
关注代码列表 |
cursors |
每个代码的增量游标,首次通常传 0 |
timeout |
读取推送队列时最多等待多少秒 |
parse |
是否尝试把推送帧解析成业务模型 |
解析字段
QuoteRefreshPage 字段 |
含义 |
requested_codes |
请求代码 |
records |
增量行情记录 |
decoded_payload |
解码后的 payload |
raw_payload |
原始 payload |
count |
记录数 |
QuoteRefreshRecord 字段 |
含义 |
exchange / market_id / code / full_code |
市场和代码 |
active |
活跃序号 / 状态序号 |
update_time_raw |
更新时间原始值 |
last_price / last_close_price |
最新价 / 昨收价 |
open_price / high_price / low_price |
今开 / 最高 / 最低 |
status_or_reserved_raw |
状态 / 保留原始字段 |
total_hand / current_hand |
总量 / 现量,单位手 |
amount / amount_raw |
成交额 / 成交额原始值 |
inside_dish / outer_disc |
内盘 / 外盘,单位手 |
unknown_after_outer_raw |
外盘后保留字段 |
open_amount_raw / open_amount_yuan |
开盘金额原始值 / 开盘金额 |
buy_levels / sell_levels |
买一到买五 / 卖一到卖五 |
tail_raw |
尾部原始字段 |
record_hex |
单条记录原始十六进制 |
buy_levels / sell_levels 单档是 QuoteLevel,字段为 price、volume、price_delta_raw。
使用说明
| 项目 |
说明 |
refresh() |
主动发一次 0x0547 请求,返回本次增量刷新页 |
poll_push() |
从 transport 推送队列取一帧;没有则返回 None |
drain_pushes() |
把当前队列里已有推送帧一次性取完 |
cursors |
每个代码的增量游标;首次通常传 0 |
get_depth() / get_quote_depth() |
直接按代码列表发起首次刷新,返回完整五档盘口 |
| 初始化 |
通常先用 7709-批量快照.md 拉初始行情,再用增量刷新 |