ek-data 0.2.8

Trading data contracts for the enkeep ek ecosystem: venue enums, zero-dep epoch-nanosecond time, decimal-exact price rounding, vt-symbol convention, bus event dictionary, tick/bar/order/trade/position/account/contract objects and request objects (Python enkeep_trade trader/object.py + constant.py, faithfully ported).
Documentation
//! 账户对象(`object.py:268-282`)。

/// 账户资金数据:余额、冻结、可用。
#[derive(Debug, Clone, PartialEq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct AccountData {
    /// 上游网关名
    pub gateway_name: String,
    /// 账户号
    pub accountid: String,

    /// 总余额
    pub balance: f64,
    /// 冻结额
    pub frozen: f64,
}

impl AccountData {
    /// `en_accountid` = `"{gateway_name}.{accountid}"`(`object.py:282`)。
    pub fn en_accountid(&self) -> String {
        format!("{}.{}", self.gateway_name, self.accountid)
    }

    /// 可用资金 = `balance - frozen`(Python `__post_init__` 暂存字段方法化)。
    pub fn available(&self) -> f64 {
        self.balance - self.frozen
    }
}