pub struct SimMatcher {
pub resting: Vec<OrderData>,
pub trade_seq: u64,
pub order_ref: u64,
pub positions: BTreeMap<(String, String), PositionData>,
pub last_bar_dt: BTreeMap<String, DtNs>,
pub tick_filled: BTreeMap<String, f64>,
}Expand description
纸面撮合器(纯逻辑零总线;金样本直断此层)。
Fields§
§resting: Vec<OrderData>在挂订单(到达序 = FIFO;终态即摘除)。
trade_seq: u64已成交笔号序列。
order_ref: u64委托引用计数(订单号尾段)。
positions: BTreeMap<(String, String), PositionData>方向位行(key = symbol × 方向原文;Direction 无 Ord → 键用 as_str)。
last_bar_dt: BTreeMap<String, DtNs>上次 bar 收口时刻(key = symbol;严格递增守卫 —— 重复/重放帧不重复撮合)。
tick_filled: BTreeMap<String, f64>本段已发生的 tick 成交量(key = symbol;bar 收口时从 bar 预算扣回 —— 防 tick 与 bar 对同一笔市场量双重计价)。
Implementations§
Source§impl SimMatcher
impl SimMatcher
Sourcepub fn place(&mut self, req: &OrderRequest) -> Result<OrderData, String>
pub fn place(&mut self, req: &OrderRequest) -> Result<OrderData, String>
下单校验 + 入挂(拒单口径与 ek-ctp 对齐:开平 NET / 类型不支持 / 量非正)。
Sourcepub fn cancel(&mut self, orderid: &str) -> Option<OrderData>
pub fn cancel(&mut self, orderid: &str) -> Option<OrderData>
撤单(接受本地号或 sim. 全号;命中即 CANCELLED 摘挂)。
Trait Implementations§
Source§impl Debug for SimMatcher
impl Debug for SimMatcher
Auto Trait Implementations§
impl Freeze for SimMatcher
impl RefUnwindSafe for SimMatcher
impl Send for SimMatcher
impl Sync for SimMatcher
impl Unpin for SimMatcher
impl UnsafeUnpin for SimMatcher
impl UnwindSafe for SimMatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.