Skip to main content

futu_proto/
lib.rs

1//! FutuOpenD Protobuf 生成的 Rust 类型
2//!
3//! 所有子模块均由 [prost-build](https://docs.rs/prost-build) 从 `.proto` 文件
4//! 自动生成(见 crate 根目录 `build.rs`),对齐 C++ OpenD `NNProtoFile/FTAPI/`
5//! 一一映射。**不要手工编辑子模块内容**;修改 schema 请改 `proto/*.proto` 后
6//! 重新 `cargo build`。
7//!
8//! 模块命名约定:每个 proto 文件对应一个子模块(`Qot_Sub.proto` →
9//! [`qot_sub`] / `Trd_PlaceOrder.proto` → [`trd_place_order`] ...),
10//! 子模块里含 `Request` / `Response` / `C2S` / `S2C` 等 prost 生成的 struct。
11//!
12//! serde 行为说明:`build.rs` 为所有 message 加了 `#[serde(default)]` 与
13//! `#[serde(deny_unknown_fields)]`。REST adapter 层仍先用
14//! `normalize_json_keys_snake_case` 兼容官方 CamelCase 字段名(`accID` / `trdEnv` /
15//! `filterConditions` / `beginTime`),再进入 generated proto serde;未知字段必须
16//! fail-closed,不能静默 drop。
17//!
18//! v1.8.0 large-file split(纯搬移, 零行为变化): 本文件只保留系统 / 连接层模块与
19//! `qot_common` / `trd_common` 共享词汇模块(同时是 `scripts/proto_schema_ledger.py`
20//! runtime_owner token 锚点); 其余按域放在同目录文件并以 `pub use <file>::*` 回导出,
21//! `futu_proto::<module>` 对外路径一个都不变:
22//! - `proto_qot.rs` — 行情域 `qot_*`
23//! - `proto_qot_option.rs` — 行情期权家族(含 `qot_option_indicator_modules.rs`)
24//! - `proto_qot_event_contract.rs` — 行情事件合约家族
25//! - `proto_trd.rs` — 交易域 `trd_*`
26//!
27//! `scripts/tests/qot_3401_plus_api_guard.sh` 扫描 `crates/futu-proto/src/*.rs` 断言模块声明.
28
29#![allow(clippy::empty_docs, clippy::tabs_in_doc_comments)]
30
31mod proto_qot;
32mod proto_qot_event_contract;
33mod proto_qot_option;
34mod proto_trd;
35
36pub use proto_qot::*;
37pub use proto_qot_event_contract::*;
38pub use proto_qot_option::*;
39pub use proto_trd::*;
40
41pub mod common {
42    include!(concat!(env!("OUT_DIR"), "/common.rs"));
43}
44
45pub mod get_delay_statistics {
46    include!(concat!(env!("OUT_DIR"), "/get_delay_statistics.rs"));
47}
48
49pub mod get_global_state {
50    include!(concat!(env!("OUT_DIR"), "/get_global_state.rs"));
51}
52
53pub mod get_user_info {
54    include!(concat!(env!("OUT_DIR"), "/get_user_info.rs"));
55}
56
57pub mod init_connect {
58    include!(concat!(env!("OUT_DIR"), "/init_connect.rs"));
59}
60
61pub mod keep_alive {
62    include!(concat!(env!("OUT_DIR"), "/keep_alive.rs"));
63}
64
65pub mod notify {
66    include!(concat!(env!("OUT_DIR"), "/notify.rs"));
67}
68
69pub mod qot_common {
70    include!(concat!(env!("OUT_DIR"), "/qot_common.rs"));
71}
72
73pub mod remote_cmd {
74    include!(concat!(env!("OUT_DIR"), "/remote_cmd.rs"));
75}
76
77pub mod skill_wrap_api {
78    include!(concat!(env!("OUT_DIR"), "/skill_wrap_api.rs"));
79}
80
81pub mod test_cmd {
82    include!(concat!(env!("OUT_DIR"), "/test_cmd.rs"));
83}
84
85pub mod trd_common {
86    include!(concat!(env!("OUT_DIR"), "/trd_common.rs"));
87}
88
89pub mod used_quota {
90    include!(concat!(env!("OUT_DIR"), "/used_quota.rs"));
91}
92
93pub mod verification {
94    include!(concat!(env!("OUT_DIR"), "/verification.rs"));
95}