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
impl QotCache
pub fn new() -> Self
Sourcepub fn update_basic_qot(&self, key: &str, qot: CachedBasicQot)
pub fn update_basic_qot(&self, key: &str, qot: CachedBasicQot)
更新基本报价
Sourcepub fn get_basic_qot(&self, key: &str) -> Option<CachedBasicQot>
pub fn get_basic_qot(&self, key: &str) -> Option<CachedBasicQot>
获取基本报价
Sourcepub fn update_klines(&self, key: &str, kl_type: i32, klines: Vec<CachedKLine>)
pub fn update_klines(&self, key: &str, kl_type: i32, klines: Vec<CachedKLine>)
更新 K 线
Sourcepub fn get_klines(&self, key: &str, kl_type: i32) -> Option<Vec<CachedKLine>>
pub fn get_klines(&self, key: &str, kl_type: i32) -> Option<Vec<CachedKLine>>
获取 K 线
Sourcepub fn update_order_book(&self, key: &str, ob: CachedOrderBook)
pub fn update_order_book(&self, key: &str, ob: CachedOrderBook)
更新摆盘
Sourcepub fn append_tickers(&self, key: &str, new_tickers: Vec<CachedTicker>)
pub fn append_tickers(&self, key: &str, new_tickers: Vec<CachedTicker>)
追加逐笔(保留最近 1000 条)
Sourcepub fn update_broker(&self, key: &str, broker: CachedBroker)
pub fn update_broker(&self, key: &str, broker: CachedBroker)
更新经纪队列
Sourcepub fn get_broker(&self, key: &str) -> Option<CachedBroker>
pub fn get_broker(&self, key: &str) -> Option<CachedBroker>
获取经纪队列
Sourcepub fn clear_security(&self, key: &str)
pub fn clear_security(&self, key: &str)
清除指定股票的所有缓存
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QotCache
impl !RefUnwindSafe for QotCache
impl Send for QotCache
impl Sync for QotCache
impl Unpin for QotCache
impl UnwindSafe for QotCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more