StaticDataCache

Struct StaticDataCache 

Source
pub struct StaticDataCache {
    pub securities: DashMap<String, CachedSecurityInfo>,
    pub id_to_key: DashMap<u64, String>,
    pub trade_dates: DashMap<String, Vec<CachedTradeDate>>,
    pub plates: DashMap<String, Vec<CachedPlateInfo>>,
    pub owner_to_warrants: RwLock<HashMap<u64, Vec<u64>>>,
}
Expand description

静态数据缓存

Fields§

§securities: DashMap<String, CachedSecurityInfo>

股票静态信息: “market_code” → info

§id_to_key: DashMap<u64, String>

stock_id → “market_code” key (反向映射,用于推送时查找)

§trade_dates: DashMap<String, Vec<CachedTradeDate>>

交易日: “market:year-month” → Vec

§plates: DashMap<String, Vec<CachedPlateInfo>>

板块: “market:plate_type” → Vec

§owner_to_warrants: RwLock<HashMap<u64, Vec<u64>>>

窝轮正股 owner_id → 该正股对应的所有窝轮 stock_id 列表 用于 GetReference(Warrant) 查询

Implementations§

Source§

impl StaticDataCache

Source

pub fn new() -> Self

Source

pub fn set_security_info(&self, key: &str, info: CachedSecurityInfo)

Source

pub fn get_security_info(&self, key: &str) -> Option<CachedSecurityInfo>

Source

pub fn get_security_info_by_stock_id( &self, stock_id: u64, ) -> Option<CachedSecurityInfo>

通过 stock_id 查找股票信息 (使用 id_to_key 反向映射)

Source

pub fn add_warrant_owner(&self, warrant_stock_id: u64, owner_stock_id: u64)

添加窝轮→正股的映射关系

Source

pub fn search_warrants_by_owner(&self, owner_stock_id: u64) -> Vec<u64>

通过正股 ID 搜索该正股的所有窝轮

Trait Implementations§

Source§

impl Default for StaticDataCache

Source§

fn default() -> Self

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.