Skip to main content

futu_qot/
lib.rs

1//! FutuOpenD 行情业务模块
2//!
3//! 实装"行情侧" 所有业务:订阅 / 快照 / K线 / 摆盘 / 分时 / 成交明细 /
4//! 静态信息 / 经纪队列 / 价格提醒等,对齐 C++ OpenD 的 `NN_ProtoCmd_Qot_*` 全集。
5//!
6//! 主要模块:
7//! - [`sub`] / [`push`] — 订阅管理 + [`QuotePushDispatcher`] 推送分发
8//! - [`basic_qot`] — 基础报价(`BasicQot`)
9//! - [`snapshot`] — 证券快照
10//! - [`kline`] / [`history_kl`] — 当日 K 线 / 历史 K 线
11//! - [`order_book`] / [`order_detail`] / [`ticker`] — 摆盘 / 逐笔 / 成交明细
12//! - [`broker`] — 经纪队列
13//! - [`rt`] — 分时数据
14//! - [`static_info`] — 证券静态信息
15//! - [`market_misc`] — 市场状态 / 股票过滤 / 期权链 / 涨跌 / 调整等
16//! - [`right_gate`] — 行情权限订阅拒绝矩阵的纯决策层
17//! - [`symbol`] — `MARKET.CODE` 用户输入解析与格式化
18//! - [`symbol_list`] — 列表型 input 契约 helper(v1.4.106 codex 0641 整体重构)
19//! - [`subscription_plan`] — 订阅请求到 backend desired options 的纯决策层
20//! - [`types`] — 核心类型([`Security`] / [`KLType`] / [`SubType`] / ...)
21
22pub mod basic_qot;
23pub mod broker;
24pub mod history_kl;
25pub mod kline;
26pub mod market_misc;
27pub mod order_book;
28pub mod order_detail;
29pub mod page_bounds;
30pub mod push;
31pub mod quote_rights;
32pub mod right_gate;
33pub mod rt;
34pub mod snapshot;
35pub mod static_info;
36pub mod sub;
37pub mod subscription_plan;
38pub mod symbol;
39pub mod symbol_list;
40pub mod ticker;
41pub mod types;
42
43#[inline]
44pub(crate) fn server_err(ret_type: i32, ret_msg: Option<String>) -> futu_core::error::FutuError {
45    let msg = match ret_msg {
46        Some(msg) if !msg.is_empty() => msg,
47        _ => "<missing ret_msg>".to_string(),
48    };
49    futu_core::error::FutuError::ServerError { ret_type, msg }
50}
51
52// Re-export 常用类型
53pub use page_bounds::{
54    PageBounds, PageBoundsError, PageBoundsErrorReason, validate_begin_num,
55    validate_optional_max_count,
56};
57pub use push::{QuoteHandler, QuotePushDispatcher};
58pub use types::{BasicQot, KLType, KLine, OrderBookData, QotMarket, RehabType, Security, SubType};
59
60#[cfg(test)]
61mod tests;