QotCache

Struct QotCache 

Source
pub struct QotCache {
    pub basic_qot: DashMap<SecurityKey, CachedBasicQot>,
    pub klines: DashMap<String, Vec<CachedKLine>>,
    pub order_books: DashMap<SecurityKey, CachedOrderBook>,
    pub tickers: DashMap<SecurityKey, Vec<CachedTicker>>,
    pub rt_data: DashMap<SecurityKey, Vec<CachedTimeShare>>,
    pub brokers: DashMap<SecurityKey, CachedBroker>,
}
Expand description

行情缓存管理器

Fields§

§basic_qot: DashMap<SecurityKey, CachedBasicQot>

基本报价缓存

§klines: DashMap<String, Vec<CachedKLine>>

K 线缓存: key = “market_code:kl_type”

§order_books: DashMap<SecurityKey, CachedOrderBook>

摆盘缓存

§tickers: DashMap<SecurityKey, Vec<CachedTicker>>

逐笔缓存: 保留最近 N 条

§rt_data: DashMap<SecurityKey, Vec<CachedTimeShare>>

分时缓存

§brokers: DashMap<SecurityKey, CachedBroker>

经纪队列缓存

Implementations§

Source§

impl QotCache

Source

pub fn new() -> Self

Source

pub fn update_basic_qot(&self, key: &str, qot: CachedBasicQot)

更新基本报价

Source

pub fn get_basic_qot(&self, key: &str) -> Option<CachedBasicQot>

获取基本报价

Source

pub fn update_klines(&self, key: &str, kl_type: i32, klines: Vec<CachedKLine>)

更新 K 线

Source

pub fn get_klines(&self, key: &str, kl_type: i32) -> Option<Vec<CachedKLine>>

获取 K 线

Source

pub fn update_order_book(&self, key: &str, ob: CachedOrderBook)

更新摆盘

Source

pub fn append_tickers(&self, key: &str, new_tickers: Vec<CachedTicker>)

追加逐笔(保留最近 1000 条)

Source

pub fn update_broker(&self, key: &str, broker: CachedBroker)

更新经纪队列

Source

pub fn get_broker(&self, key: &str) -> Option<CachedBroker>

获取经纪队列

Source

pub fn clear_security(&self, key: &str)

清除指定股票的所有缓存

Trait Implementations§

Source§

impl Default for QotCache

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.