Skip to main content

query_account_info

Function query_account_info 

Source
pub async fn query_account_info(
    backend: &BackendConn,
    acc_id: u64,
    trd_cache: &TrdCache,
    requested_currency: Option<i32>,
    requested_asset_category: Option<i32>,
) -> Result<()>
Expand description

查询真实账户资金+持仓 (CMD 3020: AccountInfoReq)

v1.4.106 codex 1556 F1+F2 (P1) 修法:

  • F1: 接 currency: Option<i32> — caller (handler) 把 user 请求的 currency 透传进来; None 时由 daemon 补账户默认币种再发 CMD3020。 对齐 C++ QueryFundNoLimit 最终要求 backend AccountInfoReq 携带有效 union_currency; backend 对缺省值会报 unsupported currency:NONE.

  • F2: transport / decode error → Err (loud propagate). 之前 Ok(()) silent 让 caller 看到 cache miss + ret_type=0 + s2c.funds=None (silent-success 反模式 D / pitfall #45). C++ 失败不会伪装成功.

  • v1.4.107: when caller has no user-requested assetCategory, match C++ GetCategoriesByKouzaType: FutuJP margin sends Foreign(2), FutuJP derivative fans out Domestic(1) + Foreign(2), other accounts send no asset_category field.