Skip to main content

futu_cache/trd_cache/types/
funds.rs

1/// 缓存的资金 (对齐 C++ Ndt_Trd_AccFund 全字段)
2#[derive(Debug, Clone, Default)]
3pub struct CachedFunds {
4    pub power: f64,                      // 最大做多购买力
5    pub total_assets: f64,               // 资产净值
6    pub cash: f64,                       // 现金
7    pub market_val: f64,                 // 证券市值
8    pub frozen_cash: f64,                // 冻结资金
9    pub debt_cash: f64,                  // 欠款金额
10    pub avl_withdrawal_cash: f64,        // 可提金额
11    pub currency: Option<i32>,           // 货币类型
12    pub available_funds: Option<f64>,    // 可用资金 (期货)
13    pub unrealized_pl: Option<f64>,      // 未实现盈亏 (期货)
14    pub realized_pl: Option<f64>,        // 已实现盈亏 (期货)
15    pub risk_level: Option<i32>,         // 风险等级
16    pub initial_margin: Option<f64>,     // 初始保证金
17    pub maintenance_margin: Option<f64>, // 维持保证金
18    pub max_power_short: Option<f64>,    // 最大做空购买力
19    pub net_cash_power: Option<f64>,     // 现金购买力
20    pub long_mv: Option<f64>,            // 多头市值
21    pub short_mv: Option<f64>,           // 空头市值
22    pub pending_asset: Option<f64>,      // 在途资产
23    pub max_withdrawal: Option<f64>,     // 最大可提
24    pub risk_status: Option<i32>,        // 风险状态码
25    pub margin_call_margin: Option<f64>, // margin call 保证金
26    pub securities_assets: Option<f64>,  // 证券资产
27    pub fund_assets: Option<f64>,        // 基金资产
28    pub bond_assets: Option<f64>,        // 债券资产
29    pub crypto_mv: Option<f64>,          // 数字货币市值
30    pub exposure_level: Option<i32>,     // 数字货币风险等级
31    pub exposure_limit: Option<f64>,     // 数字货币持仓限额
32    pub used_limit: Option<f64>,         // 数字货币已用限额
33    pub remaining_limit: Option<f64>,    // 数字货币剩余额度
34
35    // v1.4.98 T1-4 (mobile-source-audit Phase 2): US PDT (Pattern Day
36    // Trader) 6 字段. proto/Trd_Common.proto:377-382 字段 24-29.
37    // 仅富途证券(美国)账户适用. mobile App 账户首页"日内交易"卡片直接显示.
38    // futu-trd::Funds 已读 5 字段 (缺 beginning_dtbp), CachedFunds 之前
39    // 6 字段全漏 → cache-only path silent drop.
40    /// 是否 PDT 账户 (Pattern Day Trader, 仅 US)
41    pub is_pdt: Option<bool>,
42    /// 剩余日内交易次数 (string 表示, mobile UI 直接显示)
43    pub pdt_seq: Option<String>,
44    /// 初始日内交易购买力 (DTBP)
45    pub beginning_dtbp: Option<f64>,
46    /// 剩余日内交易购买力 (DTBP)
47    pub remaining_dtbp: Option<f64>,
48    /// 日内交易待缴金额 (DT Call)
49    pub dt_call_amount: Option<f64>,
50    /// 日内交易限制状态 (DTStatus enum)
51    pub dt_status: Option<i32>,
52
53    /// 分币种现金信息: (currency, cash, avl_withdrawal, net_cash_power)
54    pub cash_info_list: Vec<CachedCashInfo>,
55    /// 分市场资产信息: (trd_market, assets)
56    pub market_info_list: Vec<CachedMarketInfo>,
57}
58
59/// 分币种现金信息
60#[derive(Debug, Clone, Default)]
61pub struct CachedCashInfo {
62    /// 币种(对齐 proto `TrdCommon.Currency`)
63    pub currency: i32,
64    /// 该币种现金
65    pub cash: f64,
66    /// 该币种可用余额
67    pub available_balance: f64,
68    /// 该币种净购买力(无杠杆)
69    pub net_cash_power: f64,
70}
71
72/// 分市场资产信息
73#[derive(Debug, Clone, Default)]
74pub struct CachedMarketInfo {
75    /// 所属交易市场(对齐 proto `TrdCommon.TrdMarket`)
76    pub trd_market: i32,
77    /// 该市场资产总值
78    pub assets: f64,
79}