pub struct FillBaselineCache<T> { /* private fields */ }Expand description
Cumulative per-order baseline used to derive incremental fill values.
OKX reports fee and accFillSz cumulatively, so a fill’s incremental commission derives
from the previous message for the same ordId, as does its quantity whenever fillSz is
absent. Losing an open order’s baseline would charge its whole cumulative fee, and its whole
accumulated quantity, to the next fill.
Baselines are therefore split by order lifecycle. An order that can still fill keeps its baseline in full. A terminal order keeps one only to absorb reconnect replays, so those are held in a bounded cache that evicts oldest-first and cannot grow with session length.
Implementations§
Source§impl<T> FillBaselineCache<T>
impl<T> FillBaselineCache<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty FillBaselineCache.
Sourcepub fn get(&self, ord_id: &Ustr) -> Option<&T>
pub fn get(&self, ord_id: &Ustr) -> Option<&T>
Returns the cumulative baseline recorded for ord_id.
Trait Implementations§
Source§impl<T: Debug> Debug for FillBaselineCache<T>
impl<T: Debug> Debug for FillBaselineCache<T>
Auto Trait Implementations§
impl<T> Freeze for FillBaselineCache<T>
impl<T> RefUnwindSafe for FillBaselineCache<T>where
AHashMap<Ustr, T>: RefUnwindSafe,
FifoCacheMap<Ustr, T, TERMINAL_BASELINE_CAPACITY>: RefUnwindSafe,
impl<T> Send for FillBaselineCache<T>
impl<T> Sync for FillBaselineCache<T>
impl<T> Unpin for FillBaselineCache<T>
impl<T> UnsafeUnpin for FillBaselineCache<T>where
AHashMap<Ustr, T>: UnsafeUnpin,
FifoCacheMap<Ustr, T, TERMINAL_BASELINE_CAPACITY>: UnsafeUnpin,
impl<T> UnwindSafe for FillBaselineCache<T>where
AHashMap<Ustr, T>: UnwindSafe,
FifoCacheMap<Ustr, T, TERMINAL_BASELINE_CAPACITY>: UnwindSafe,
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more