Skip to main content

CachedOrderSnapshot

Struct CachedOrderSnapshot 

Source
pub struct CachedOrderSnapshot {
Show 14 fields pub backend_order_id: String, pub order_version: i32, pub exchange_code: i32, pub exchange: String, pub security_type: i32, pub order_type: i32, pub trd_side: i32, pub order_status: i32, pub trd_market: Option<i32>, pub qty: f64, pub price: f64, pub code: String, pub is_stub: bool, pub is_pending_broker_confirm: bool,
}
Expand description

v1.4.106 codex 0219 Finding 1+4: trade-write resolution snapshot.

用于 ModifyOrder / CancelOrder handler 把 cached order 字段一次性 拿出来构造 backend req. 不在 hot path 改 CachedOrder, 而是返一个 只读 snapshot 防 caller mutate cache.

字段 1:1 映射 backend OrderReplaceReq / OrderCancelReq 必填项 + modify validation 用到的 (order_type / trd_side / qty / price / order_status).

Fields§

§backend_order_id: String

= backend szOrderID (alphanumeric 字符串, 服务端真实 id).

§order_version: i32

= backend Order.version.

§exchange_code: i32

= backend Order.exchange_code (期货所属交易所代码, e.g. NN_QotMarket).

§exchange: String

= backend Order.exchange (股票所属交易所字符串, e.g. “SEHK”).

§security_type: i32

= backend Order.security_type (1=COMMON, 2=OPTION, 4=FUTURES, 5=BOND).

§order_type: i32

FTAPI OrderType (modify validation 按原 order_type 决定 price / aux_price / trail* 是否必填).

§trd_side: i32

FTAPI TrdSide (1=Buy / 2=Sell / 3=SellShort / 4=BuyBack). trailing modify 计算 sign 用.

§order_status: i32

FTAPI OrderStatus (IsNotSupportOrderOp 检查用).

§trd_market: Option<i32>

FTAPI TrdMarket (modify validation 中 sec_type futures 路径用).

§qty: f64

FTAPI Order.qty (历史值, 仅 modify validation 引用).

§price: f64

FTAPI Order.price (历史值, 仅 modify validation 引用).

§code: String

FTAPI Order.code (用于错误提示 + log 关联).

§is_stub: bool

PlaceOrder stub 标记. PlaceOrder ack 时插入的 stub is_stub=true + order_version=0. ModifyOrder 按 C++ 本地回显订单 nVersion=-1 映射为 backend wire u32::MAX; CancelOrder 不依赖 order_version.

§is_pending_broker_confirm: bool

PlaceOrder stub 是否仍在等待 broker/backend 权威确认.

Real write handlers use this to avoid reporting success against a local optimistic echo when the authoritative order list has not accepted the order yet.

Implementations§

Source§

impl CachedOrderSnapshot

Source

pub fn from_order(o: &CachedOrder) -> Self

CachedOrder 抽出 trade-write resolution 用到的字段子集.

Trait Implementations§

Source§

impl Clone for CachedOrderSnapshot

Source§

fn clone(&self) -> CachedOrderSnapshot

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 CachedOrderSnapshot

Source§

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

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

impl Default for CachedOrderSnapshot

Source§

fn default() -> CachedOrderSnapshot

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

impl PartialEq for CachedOrderSnapshot

Source§

fn eq(&self, other: &CachedOrderSnapshot) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for CachedOrderSnapshot

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