Skip to main content

futucli/cli/commands/
sys.rs

1//! System/status clap argument structs split from commands.rs.
2
3use clap::Args;
4
5#[derive(Args)]
6pub struct QuoteRightsArgs {
7    /// 查询前先触发 request_highest_quote_right 刷新
8    #[arg(long)]
9    pub(crate) refresh: bool,
10}
11
12#[derive(Args)]
13pub struct TickerStatisticArgs {
14    /// 证券 symbol (e.g. HK.00700, US.AAPL) — 位置参数或 --symbol 二选一
15    #[arg(index = 1, value_name = "SYMBOL")]
16    pub(crate) symbol_pos: Option<String>,
17
18    /// 证券 symbol (named arg form, 兼容老用法)
19    #[arg(long = "symbol", conflicts_with = "symbol_pos")]
20    pub(crate) symbol: Option<String>,
21
22    /// 逐笔类型 0=ALL, 1=BUY, 2=SELL, 3=BUY_AND_SELL, 4=NEUTRAL
23    #[arg(long)]
24    pub(crate) ticker_type: Option<i32>,
25
26    /// 市场状态 0=ALL, 1=BEFORE, 2=TRADING, 3=AFTER
27    #[arg(long)]
28    pub(crate) stat_type: Option<u32>,
29}
30
31#[derive(Args)]
32pub struct TickerStatisticDetailArgs {
33    /// 证券 symbol (e.g. HK.00700, US.AAPL) — 位置参数或 --symbol 二选一
34    #[arg(index = 1, value_name = "SYMBOL")]
35    pub(crate) symbol_pos: Option<String>,
36
37    /// 证券 symbol (named arg form, 兼容老用法)
38    #[arg(long = "symbol", conflicts_with = "symbol_pos")]
39    pub(crate) symbol: Option<String>,
40
41    /// 逐笔类型 0=ALL, 1=BUY, 2=SELL, 3=BUY_AND_SELL, 4=NEUTRAL
42    #[arg(long)]
43    pub(crate) ticker_type: Option<i32>,
44
45    /// 时间戳 (ms) — 通常从前一次 ticker-statistic call 拿到. 0/省略 = backend 默认
46    #[arg(long)]
47    pub(crate) ticker_time: Option<u64>,
48
49    /// 筛选 0=全部价位 / 1..N=top N 价位 (backend max ~100)
50    #[arg(long)]
51    pub(crate) select_num: Option<u32>,
52
53    /// 分页 起始项 (默认 0)
54    #[arg(long)]
55    pub(crate) data_from: Option<u32>,
56
57    /// 分页 size 单页最大 (默认 20)
58    #[arg(long)]
59    pub(crate) data_max_count: Option<u32>,
60
61    /// 市场状态 0=ALL, 1=BEFORE, 2=TRADING, 3=AFTER
62    #[arg(long)]
63    pub(crate) stat_type: Option<u32>,
64}
65
66#[derive(Args)]
67pub struct QuerySubscriptionArgs {
68    /// 是否查询所有连接(默认只查本连接)
69    #[arg(long)]
70    pub(crate) all_conn: bool,
71}
72
73#[derive(Args)]
74pub struct UnsubscribeArgs {
75    /// 证券列表,逗号分隔(--all 时忽略)
76    #[arg(long, default_value = "")]
77    pub(crate) symbols: String,
78
79    /// 订阅类型 id 列表,逗号分隔(proto Qot_Common.SubType: 1=Basic 2=OrderBook
80    /// 4=Ticker 5=RT 6=KL_Day 7=KL_5Min 8=KL_15Min 9=KL_30Min 10=KL_60Min
81    /// 11=KL_1Min 12=KL_Week 13=KL_Month 14=Broker 15=KL_Quarter 16=KL_Year
82    /// 17=KL_3Min, 跳 3=None)
83    #[arg(long, default_value = "")]
84    pub(crate) sub_types: String,
85
86    /// 清空本连接所有订阅
87    #[arg(long)]
88    pub(crate) all: bool,
89}
90
91#[derive(Args)]
92pub struct HistoryKlQuotaArgs {
93    /// 是否返回每只股票的下载详情(默认 false)
94    #[arg(long)]
95    pub(crate) detail: bool,
96}
97
98#[derive(Args)]
99pub struct DaemonStatusArgs {
100    /// 目标 REST 端口 URL(默认从 FUTU_REST_URL 环境变量读,或 http://127.0.0.1:22222)
101    #[arg(long)]
102    pub(crate) rest_url: Option<String>,
103
104    /// v1.4.52 BUG-9: REST/MCP 风格用户习惯指定 port,自动转 http://127.0.0.1:<port>
105    #[arg(long, conflicts_with = "rest_url")]
106    pub(crate) rest_port: Option<u16>,
107
108    /// 带 Bearer Token(scope 模式下需要 admin scope 的 key)
109    #[arg(long)]
110    pub(crate) api_key: Option<String>,
111}
112
113#[derive(Args)]
114pub struct DaemonShutdownArgs {
115    /// 目标 REST 端点 URL(默认从 FUTU_REST_URL 环境变量读,或 http://127.0.0.1:22222)
116    #[arg(long)]
117    pub(crate) rest_url: Option<String>,
118
119    /// v1.4.106 codex 0554 F5 [P3]: 风格一致性 — 与 daemon-status 对齐,
120    /// REST/MCP 风格用户习惯指定 port, 自动转 http://127.0.0.1:<port>.
121    #[arg(long, conflicts_with = "rest_url")]
122    pub(crate) rest_port: Option<u16>,
123
124    /// 带 Bearer Token(scope 模式下需要 admin scope 的 key)
125    #[arg(long)]
126    pub(crate) api_key: Option<String>,
127}
128
129#[derive(Args)]
130pub struct DaemonReloadArgs {
131    /// 目标 REST 端点 URL(默认从 FUTU_REST_URL 环境变量读,或 http://127.0.0.1:22222)
132    #[arg(long)]
133    pub(crate) rest_url: Option<String>,
134
135    /// v1.4.106 codex 0554 F5 [P3]: 风格一致性 — 与 daemon-status 对齐,
136    /// REST/MCP 风格用户习惯指定 port, 自动转 http://127.0.0.1:<port>.
137    #[arg(long, conflicts_with = "rest_url")]
138    pub(crate) rest_port: Option<u16>,
139
140    /// 带 Bearer Token(scope 模式下需要 admin scope 的 key)
141    #[arg(long)]
142    pub(crate) api_key: Option<String>,
143}