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:592-604`;通常由 [`crate::order::OrderData::create_cancel_request`]
//! 生成)。

use crate::constant::Exchange;

/// 发往网关的撤单请求。
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct CancelRequest {
    /// 委托号(网关内唯一)
    pub orderid: String,
    /// 合约代码
    pub symbol: String,
    /// 交易所
    pub exchange: Exchange,
}

impl CancelRequest {
    /// `en_symbol`(派生方法)。
    pub fn en_symbol(&self) -> String {
        crate::symbol::vt_symbol(&self.symbol, self.exchange)
    }

    /// `en_orderid` = `"{gateway_name}.{orderid}"`(与 OrderData 同式)。
    pub fn en_orderid(&self, gateway_name: &str) -> String {
        format!("{gateway_name}.{}", self.orderid)
    }
}