pub struct GenKeyArgs {Show 16 fields
pub(crate) id: String,
pub(crate) scopes: String,
pub(crate) keys_file: Option<PathBuf>,
pub(crate) expires: Option<String>,
pub(crate) note: Option<String>,
pub(crate) allowed_markets: Option<String>,
pub(crate) allowed_symbols: Option<String>,
pub(crate) max_order_value: Option<f64>,
pub(crate) max_daily_value: Option<f64>,
pub(crate) hours_window: Option<String>,
pub(crate) max_orders_per_minute: Option<u32>,
pub(crate) allowed_trd_sides: Option<String>,
pub(crate) allowed_acc_ids: Option<String>,
pub(crate) allowed_card_nums: Option<String>,
pub(crate) bind_this_machine: bool,
pub(crate) bind_machines: Option<String>,
}Fields§
§id: String人读 ID(审计日志用,必须唯一)
scopes: String授予的 scope,逗号分隔(v1.4.34+ 补齐 admin;详见 –help 的 scopes 长说明)
keys_file: Option<PathBuf>keys.json 路径。默认(按 OS):macOS ~/Library/Application Support/futu/keys.json / Linux ~/.config/futu/keys.json / Windows %APPDATA%/futu/keys.json
expires: Option<String>过期时间: Nd / Nh / Nm 或 RFC3339(如 2026-12-31T23:59:59Z)
note: Option<String>备注
allowed_markets: Option<String>允许的市场,逗号分隔(如 HK,US)
allowed_symbols: Option<String>允许的品种白名单,逗号分隔(MARKET.CODE 格式,如 HK.00700,HK.09988)
max_order_value: Option<f64>单笔订单金额上限
max_daily_value: Option<f64>单日累计金额上限
hours_window: Option<String>允许交易的时间窗口(服务器本地时区)HH:MM-HH:MM,跨午夜如 22:00-04:00
max_orders_per_minute: Option<u32>每 60s 最多下单次数(滑动窗口速率限制)
单笔金额 / 日累计之外再加一层防 spray-and-pray:
假设攻击者拿到一把 max_order_value = 50 的 key,没速率限制的话
一分钟能刷 N 千单;加了这个就被钳制在 max_orders_per_minute 内。
allowed_trd_sides: Option<String>允许的交易方向白名单,逗号分隔
典型用法:--allowed-trd-sides SELL → 只允许平仓 bot 卖;
值:BUY / SELL / SELL_SHORT / BUY_BACK(大小写敏感)。
改单 / 撤单路径不带 side,不受此限制(避免误伤运维操作)。
allowed_acc_ids: Option<String>v1.4.35: 允许的 acc_id 白名单,逗号分隔(如 10001,10002)
operational safety:该 key 只能对这些 acc_id 发 trade / unlock / query 操作;超出列表的 acc_id 直接 403。None / 空 → 不限(向后兼容)。
典型用法(多 agent 隔离):
--allowed-acc-ids 10001,10002 → bot-A 只能动 10001/10002
--allowed-acc-ids 10003 → bot-B 只能动 10003
注意:这是 operational 隔离(防 agent bug / LLM 幻觉 / key 泄露 爆炸半径),对纯现金策略用户实质等同财务隔离。真·财务隔离(融资 / 期权组合 / 跨品种保证金)需要多 union card,见 CLAUDE.md 隔离层级。
allowed_card_nums: Option<String>v1.4.103 (B10): per-key card_num 白名单, 逗号分隔.
接受 4 位 suffix (App 显示的 “保证金综合账户(<card-suffix>)”
末 4 位) 或 16 位完整 card_num (e.g. <full-card-num>).
示例为 synthetic placeholder, 不是真实账户信息. daemon 启动后通过
GetAccList resolve → 合并进 allowed_acc_ids (内部仍用 u64).
设计动机: App 用户看到的是 card_num, 不是内部 acc_id. 直接
写 4 位 / 16 位避免先调 /api/accounts 拿映射.
典型用法 (与 –allowed-acc-ids 等价但用 App 可见的号码):
–allowed-card-nums
多 suffix 撞 (短 4 位 match 多账户) → daemon 启动 log warn + skip (loud, 不静默接受). 找不到 → log warn + skip (cache load 后可补).
bind_this_machine: bool将 key 绑定到本机(软绑定:读 machine-id 计算指纹)
设置后 key 只能在本机使用;复制到别的机器会被拒。
可以和 --bind-machines 同时用来同时允许多台机器。
bind_machines: Option<String>追加绑定其他机器(需要对方先跑 futucli machine-id --for-key <id> 拿指纹)
逗号分隔的 64 位 hex 指纹列表,如: –bind-machines aabb…,ccdd…
Trait Implementations§
Source§impl Args for GenKeyArgs
impl Args for GenKeyArgs
Source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
ArgGroup::id][crate::ArgGroup::id] for this set of argumentsSource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command] so it can instantiate self via
[FromArgMatches::update_from_arg_matches_mut] Read moreSource§impl FromArgMatches for GenKeyArgs
impl FromArgMatches for GenKeyArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.