pub fn scope_for_proto_id(proto_id: u32) -> Option<Scope>Expand description
Futu API protocol id → 所需 scope 的通用映射
gRPC 和核心 WS 都用这个函数做 scope 检查。proto_id 常量定义在 futu-core
(circular dep 顾虑下这里手动枚举);新增 proto 时必须同步更新这里的 match
分支,否则落到 catch-all TradeReal 被拒(fail-closed)。
| proto_id 范围 | 所需 scope |
|---|---|
| 1xxx 系统(InitConnect / GetGlobalState / KeepAlive / …) | 无(放行) |
| 3xxx 行情(含 push updates) | qot:read |
| 2005 UnlockTrade | trade:real |
| 2202 PlaceOrder / 2205 ModifyOrder / 2237 ReconfirmOrder | trade:real |
| 2xxx 账户只读(AccList / Funds / Positions / Orders / Deals / 费率 / push) | acc:read |
| 其他 | catch-all trade:real(fail-closed) |