Skip to main content

CheckCtx

Struct CheckCtx 

Source
pub struct CheckCtx {
    pub market: String,
    pub symbol: String,
    pub order_value: Option<f64>,
    pub trd_side: Option<String>,
    pub acc_id: Option<u64>,
    pub mutation_no_exposure: bool,
    pub currency: Option<String>,
}
Expand description

限额检查上下文:一次下单的 market/symbol/金额/方向

Fields§

§market: String

“HK” / “US” / “CN” / “HKCC” 等

§symbol: String

“HK.00700” 格式(market + code);空串 表示调用方无法推导 symbol (改单 / 撤单路径),此时 symbol 白名单检查被跳过(但 market 仍会被校验)。

§order_value: Option<f64>

qty × price(本币);None 表示无法计算(如 MARKET 单),跳过金额检查

§trd_side: Option<String>

交易方向字符串("BUY" / "SELL" / …);None 表示无需方向校验 (改单 / 撤单路径)

§acc_id: Option<u64>

v1.4.35:被操作的账户 ID;None 表示此请求不涉及特定账户(全局请求 如 subscribe / quote,跳过 acc_id 白名单检查)。

§mutation_no_exposure: bool

v1.4.106 codex 0538 F2 (P2): typed marker — 此 mutation 不产生 新 exposure delta(撤单 / 失效 / 生效 / 删除老单)。

语义:true = 改 daemon 状态但不动 risk exposure(不跑 daily counter, 但仍跑 acc_id / market / rate / hours 白名单)。 false = 真有 exposure delta(PlaceOrder, ModifyOrder Normal)→ 必须给 order_value 让 daily counter 累加.

区分 ModifyOrder 5 种 op:

modify_order_op含义mutation_no_exposureorder_value
1 (Normal)改价 / 改量 → 新 exposurefalseSome(qty*price)
2 (Cancel)撤单 → 减 exposuretrueNone
3 (Disable)失效trueNone
4 (Enable)生效(之前 Disable)trueNone (cap 难算)
5 (Delete)删除老单trueNone

保守语义:Enable 理论可重新激活老单产生 exposure, 但不知 qty/price 上下文(仅靠 order_id),无法算 order_value → 标 mutation_no_exposure = true(跳 daily counter);rate-window 仍计数挡 spray attack。

默认 false: 所有 PlaceOrder / 已知 exposure 路径默认 false(保守)。

§currency: Option<String>

v1.4.106 codex 0538 F4 (P3): 订单币种 (HKD / USD / CNY / JPY / SGD / AUD / MYR / CAD 等)

None = legacy 单桶模式 (counter 全合并到 _default_ key, 与 v1.4.105 行为完全等价);

Some(ccy) = per-currency 桶 (HKD / USD / … 各自独立 daily counter, USD 单不消耗 HKD 配额, 防 cross-currency dilution).

Limits::max_daily_value cap 解释成每个 currency 桶独立 cap.

由调用方从 market 派生 (见 market_to_currency).

Trait Implementations§

Source§

impl Clone for CheckCtx

Source§

fn clone(&self) -> CheckCtx

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 CheckCtx

Source§

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

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

impl Default for CheckCtx

Source§

fn default() -> CheckCtx

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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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