完整行情 / 五档盘口¶
作用¶
查询一个或一批证券的完整当前行情。client.helpers.full_quotes(codes) 是普通用户的推荐入口:它先用 0x054c 获取基础快照,再用 0x0547 补齐实时五档,最后合并为统一的 QuoteSnapshot。
| 项目 | 内容 |
|---|---|
| 主要调用 | client.helpers.full_quotes(codes) |
| 底层能力 | 0x054c 基础快照 + 0x0547 五档刷新 |
| 自动拆批 | 每批最多 80 个代码 |
| 返回模型 | list[QuoteSnapshot] |
示例¶
from eltdx import TdxClient
with TdxClient(timeout=3) as client:
one = client.helpers.full_quotes("sz000001")[0]
many = client.helpers.full_quotes([
"sz000001",
"sh600000",
"bj920856",
])
print(one.last_price, one.buy_levels, one.sell_levels)
参数¶
| 参数 | 含义 |
|---|---|
codes |
单个完整代码或代码列表;无市场前缀时会按代码段补全 |
返回字段¶
每个 QuoteSnapshot 包含:
| 字段 | 含义 |
|---|---|
exchange / market_id / code / full_code |
市场和代码 |
last_price / pre_close_price |
最新价 / 昨收价 |
open_price / high_price / low_price |
今开 / 最高 / 最低 |
total_hand / current_hand |
总成交量 / 现手,单位手 |
amount |
成交额 |
inside_dish / outer_disc |
内盘 / 外盘 |
open_amount_yuan |
开盘金额,单位元 |
buy_levels / sell_levels |
买一到买五 / 卖一到卖五 |
change / change_pct |
涨跌额 / 涨跌幅 |
sum_buy_vol / sum_sell_vol |
五档买量 / 卖量合计 |
单档盘口是 QuoteLevel,包含 price、volume 和 price_delta_raw。
与其他行情入口的区别¶
| 需求 | 使用方法 |
|---|---|
| 普通业务查询完整当前行情 | client.helpers.full_quotes(codes) |
只要 0x054c 原生基础快照 |
client.quotes.get_snapshots(codes) |
直接操作 0x0547 五档、游标或推送 |
client.quotes.get_depth() / refresh() |
| 兼容旧协议或读取旧版状态原始字段 | client.quotes.legacy(codes) |
如果某次 0x0547 没有返回可合并的完整五档,Helper 会保留 0x054c 基础快照,不会把整个查询判为失败。
真实返回样本¶
真实返回 JSON · 完整行情(1 条节选)
真实采样;Helper 合并 0x054c 与 0x0547,档位列表只展示一档。
{
"exchange": "sz",
"code": "000001",
"last_price": 11.1,
"pre_close_price": 11.11,
"open_price": 11.2,
"high_price": 11.22,
"low_price": 11.07,
"total_hand": 929043,
"amount": 1031951488.0,
"open_amount_yuan": 23573760.0,
"buy_levels": [
{"price": 11.1, "volume": 362, "price_delta_raw": 0}
],
"sell_levels": [
{"price": 0.0, "volume": 0, "price_delta_raw": -1110}
]
}