pub struct TrdCache {
pub accounts: DashMap<AccKey, CachedTrdAcc>,
pub funds: DashMap<AccKey, CachedFunds>,
pub positions: DashMap<AccKey, Vec<CachedPosition>>,
pub orders: DashMap<AccKey, Vec<CachedOrder>>,
pub ciphers: DashMap<AccKey, Vec<u8>>,
}Expand description
交易数据缓存
Fields§
§accounts: DashMap<AccKey, CachedTrdAcc>账户列表
funds: DashMap<AccKey, CachedFunds>资金: acc_id → funds
positions: DashMap<AccKey, Vec<CachedPosition>>持仓: acc_id → Vec
orders: DashMap<AccKey, Vec<CachedOrder>>当日订单: acc_id → Vec
ciphers: DashMap<AccKey, Vec<u8>>交易 cipher: acc_id → cipher bytes (解锁后获得)
Implementations§
Source§impl TrdCache
impl TrdCache
pub fn get_cipher(&self, acc_id: u64) -> Option<Vec<u8>>
pub fn set_cipher(&self, acc_id: u64, cipher: Vec<u8>)
pub fn new() -> Self
pub fn set_accounts(&self, accounts: Vec<CachedTrdAcc>)
pub fn get_accounts(&self) -> Vec<CachedTrdAcc>
pub fn update_funds(&self, acc_id: u64, funds: CachedFunds)
pub fn update_positions(&self, acc_id: u64, positions: Vec<CachedPosition>)
pub fn update_orders(&self, acc_id: u64, orders: Vec<CachedOrder>)
Sourcepub fn upsert_order(&self, acc_id: u64, order: CachedOrder)
pub fn upsert_order(&self, acc_id: u64, order: CachedOrder)
更新单个订单(推送场景)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TrdCache
impl !RefUnwindSafe for TrdCache
impl Send for TrdCache
impl Sync for TrdCache
impl Unpin for TrdCache
impl UnwindSafe for TrdCache
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