Skip to main content

CachedTrdAcc

Struct CachedTrdAcc 

Source
pub struct CachedTrdAcc {
Show 25 fields pub acc_id: u64, pub intra_acc_id: Option<u64>, pub trd_env: i32, pub trd_market_auth_list: Vec<i32>, pub acc_type: Option<i32>, pub card_num: Option<String>, pub security_firm: Option<i32>, pub sim_acc_type: Option<i32>, pub uni_card_num: Option<String>, pub acc_status: Option<i32>, pub acc_open_state: Option<i32>, pub acc_role: Option<i32>, pub acc_label: Option<String>, pub jp_acc_type: Vec<i32>, pub owner_uid: Option<u64>, pub opr_uid: Option<u64>, pub mixed_state: Option<i32>, pub ira_type: Option<i32>, pub grant_state: Option<i32>, pub kouza_type: Option<i32>, pub trd_market: Option<i32>, pub association_acc_id: Option<u64>, pub acc_flag: Option<i32>, pub order_index: usize, pub sort_key: u64,
}
Expand description

缓存的账户信息

Fields§

§acc_id: u64

账户 ID

§intra_acc_id: Option<u64>

后端/mobile native intra account id (C++ Ndt_Trd_AccItem.nIntraAccID).

公开 FTAPI acc_id 与 backend 查询 body 里的 account_id 不是同一层 语义。需要发 backend native account_id 的 handler 应优先用这个字段, 不要从公开 acc_id 低 32 位反推。

§trd_env: i32

交易环境(0=Simulate / 1=Real)

§trd_market_auth_list: Vec<i32>

该账户有权限访问的交易市场列表

§acc_type: Option<i32>

账户类型(Cash / Margin / Derivative / …)

§card_num: Option<String>

账户卡号(后段数字,仅用于显示识别)

§security_firm: Option<i32>

账户所属 broker(FutuHK=1 / FutuUS=2 / …)

§sim_acc_type: Option<i32>

模拟账户子类型

§uni_card_num: Option<String>

统一卡号(跨市场账户聚合标识)

§acc_status: Option<i32>

账户状态码(正常 / 冻结 / …)

§acc_open_state: Option<i32>

Backend raw FTUsrTrdAcc::Account.state.

C++ API layer keeps this distinct from public TrdAccStatus: OPENED(1) is returned as Active, CLOSED(2) is returned in the disabled-real tail, while OPENING(0) is skipped by APIServer_Trd_GetAccList.cpp:109-115. Do not derive this back from acc_status, because both CLOSED and OPENING are non-active.

§acc_role: Option<i32>

账户角色(主账户 / 子账户 / 顾问)

§acc_label: Option<String>

Daemon-derived user-visible account label.

Some opened business accounts are not representable by Trd_Common.TrdMarket (for example crypto) or overload protocol role values (for example equity-incentive / IPO route). The bridge derives a label from backend account metadata and stores it here so public account discovery does not rely on numeric market allowlists.

§jp_acc_type: Vec<i32>

日本账户附加类型标签

§owner_uid: Option<u64>

账户所有者 UID

§opr_uid: Option<u64>

账户操作者 UID

§mixed_state: Option<i32>

混合状态 (C++ enAccState / MixedState)

§ira_type: Option<i32>

IRA 类型 (CA: TFSA=1, RRSP=2, SRRSP=3)

§grant_state: Option<i32>

授权状态 (GrantState)

§kouza_type: Option<i32>

口座类型 (JP: Cash=1, Margin=2, Derivative=3)

§trd_market: Option<i32>

交易市场 (Account.market, 单个值)

§association_acc_id: Option<u64>

关联账户 ID (基金账户绑定)

§acc_flag: Option<i32>

综合账户子账户标志 (0=非子账户)

§order_index: usize

原始顺序索引 (用于保持后端返回的自然顺序)

§sort_key: u64

C++ 排序 key: (BrokerID << 48) | (TrdMkt << 32) | IntraAccID

Implementations§

Source§

impl CachedTrdAcc

Source

pub fn is_crypto_account(&self) -> bool

v1.4.108: identify crypto from bridge-derived backend metadata label.

Account discovery must not hide opened crypto accounts, but Trd_Common has no public TrdMarket_Crypto variant. The bridge therefore derives acc_label=crypto from FTUsrTrdAcc.AccountMarket::Crypto / TradingCapability::NaCrypto; cache consumers should read that label rather than re-hardcoding market numbers.

Source

pub fn is_encrypted(&self) -> bool

Source

pub fn derive_acc_label(&self) -> Option<&str>

v1.4.97 J-Acc-Q3 + v1.4.98 T2-6: derived acc_label for /api/accounts REST response.

Priority order:

  1. bridge-derived backend label (crypto, equity_incentive, ipo_route, …);
  2. "paper_trade"trd_env==0 (Simulate) (v1.4.98).

Returns None for “no special label” (default Margin / regular Cash).

Spec: REST-only enrichment (no proto change for gRPC clients — gRPC 不看 proto extension field, 只看 /api/accounts REST output). Clients should treat unknown labels as opaque strings for forward compatibility (v1.5+ may add more labels per pitfall #51 v1.4.94 mod).

Labels are opaque strings for clients. Unknown labels should be rendered as-is rather than treated as an error.

Trait Implementations§

Source§

impl AccountCardRecord for CachedTrdAcc

Source§

fn acc_id(&self) -> u64

Source§

fn card_num(&self) -> Option<&str>

Source§

fn uni_card_num(&self) -> Option<&str>

Source§

impl Clone for CachedTrdAcc

Source§

fn clone(&self) -> CachedTrdAcc

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CachedTrdAcc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CachedTrdAcc

Source§

fn default() -> CachedTrdAcc

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more