Skip to main content

QotSecurityKey

Struct QotSecurityKey 

Source
pub struct QotSecurityKey {
    pub public_sec_key: String,
    pub stock_key: QotStockKey,
}
Expand description

QOT broker-aware security key (复合): public "market_code" + broker-aware QotStockKey.

  • public_sec_key: FTAPI Security 字段回显形态 (“market_code”), 不带 broker. 给 handler response / first-push replay / display 用.
  • stock_key: cache / subscription manager / push registry 内部识别, 带 broker.

同 stock_id 不同 broker 的 crypto 订阅:

QotSecurityKey { public_sec_key: "91_BTCUSDT", stock_key: QotStockKey { stock_id: 12345, broker_id: Some(1007) } }
QotSecurityKey { public_sec_key: "91_BTCUSDT", stock_key: QotStockKey { stock_id: 12345, broker_id: Some(1008) } }

两者 public_sec_key 相同 (用户看到同一 symbol), 但 stock_key 不同 (内部隔离).

Fields§

§public_sec_key: String§stock_key: QotStockKey

Implementations§

Source§

impl QotSecurityKey

Source

pub fn no_broker(public_sec_key: String, stock_id: u64) -> Self

普通 no-broker security key.

Source

pub fn from_broker_id( public_sec_key: String, stock_id: u64, broker_id: u32, ) -> Self

broker-aware security key. broker_id = 0 自动降级 no-broker.

Source

pub fn cache_key(&self) -> String

内部 cache encoding: "{market_code}@b{broker_id}" (broker-aware) 或 "{market_code}" (no-broker).

Source

pub fn cache_key_cow(&self) -> Cow<'_, str>

Borrow the public key for ordinary securities and allocate only when a broker suffix is required.

Source

pub fn parse_public_sec_key(sec_key: &str) -> Option<QotPublicSecKey<'_>>

Parse public FTAPI sec_key envelope "{market}_{code}".

Only the first underscore belongs to the envelope; the code suffix may contain additional underscores (e.g. 11_BRK_B).

Source

pub fn parse_cache_key(cache_key: &str) -> Option<(String, Option<u32>)>

v1.4.110 codex Phase 3 Slice 6b: parse cache_key() display string back to (public_sec_key, Option<broker_id>).

(public_sec_key, Some(broker_id)) if 输入含 @bN suffix; 否则 (input, None). 解析失败 (e.g. @bNot_A_Number) 返 None.

用于 SubscriptionManager.qot_global_desired_keys() 返 display string 时, rebuild 路径要还原 broker dimension 才能 cache lookup.

Trait Implementations§

Source§

impl Clone for QotSecurityKey

Source§

fn clone(&self) -> QotSecurityKey

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QotSecurityKey

Source§

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

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

impl Eq for QotSecurityKey

Source§

impl Hash for QotSecurityKey

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for QotSecurityKey

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 QotSecurityKey

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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<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