pub struct TickFilter { /* private fields */ }Expand description
Filters ticks by optional symbol, side, price range, and minimum quantity predicates.
All predicates are ANDed together. Unset predicates always pass.
Implementations§
Source§impl TickFilter
impl TickFilter
Sourcepub fn min_quantity(self, q: Quantity) -> Self
pub fn min_quantity(self, q: Quantity) -> Self
Restrict matches to ticks with quantity >= q.
Sourcepub fn max_quantity(self, q: Quantity) -> Self
pub fn max_quantity(self, q: Quantity) -> Self
Restrict matches to ticks with quantity <= q.
Sourcepub fn min_notional(self, n: Decimal) -> Self
pub fn min_notional(self, n: Decimal) -> Self
Restrict matches to ticks with notional (price * quantity) >= n.
Sourcepub fn max_notional(self, n: Decimal) -> Self
pub fn max_notional(self, n: Decimal) -> Self
Restrict matches to ticks with notional (price * quantity) <= n.
Sourcepub fn timestamp_range(self, from: NanoTimestamp, to: NanoTimestamp) -> Self
pub fn timestamp_range(self, from: NanoTimestamp, to: NanoTimestamp) -> Self
Restrict matches to ticks whose timestamp falls within [from, to] (inclusive).
Sourcepub fn has_symbol_filter(&self) -> bool
pub fn has_symbol_filter(&self) -> bool
Returns true if a symbol predicate has been set on this filter.
Sourcepub fn has_side_filter(&self) -> bool
pub fn has_side_filter(&self) -> bool
Returns true if a side predicate has been set on this filter.
Sourcepub fn has_min_qty_filter(&self) -> bool
pub fn has_min_qty_filter(&self) -> bool
Returns true if a minimum quantity predicate has been set on this filter.
Sourcepub fn has_price_filter(&self) -> bool
pub fn has_price_filter(&self) -> bool
Returns true if a price range predicate has been set on this filter.
Sourcepub fn has_notional_filter(&self) -> bool
pub fn has_notional_filter(&self) -> bool
Returns true if a notional (min or max) predicate has been set on this filter.
Sourcepub fn clear(self) -> Self
pub fn clear(self) -> Self
Resets all predicates, returning a fresh filter that matches every tick.
Allows reuse of a filter builder without allocating a new one.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if no predicates are configured — the filter matches any tick.
Callers can skip filter evaluation entirely when no constraints have been set, avoiding unnecessary field comparisons on every tick.
Sourcepub fn matches(&self, tick: &Tick) -> bool
pub fn matches(&self, tick: &Tick) -> bool
Returns true if the tick satisfies all configured predicates.
Sourcepub fn count_matches(&self, ticks: &[Tick]) -> usize
pub fn count_matches(&self, ticks: &[Tick]) -> usize
Returns the number of ticks in ticks that satisfy all predicates.
Equivalent to ticks.iter().filter(|t| self.matches(t)).count() but
avoids allocating a filtered collection.
Trait Implementations§
Source§impl Clone for TickFilter
impl Clone for TickFilter
Source§fn clone(&self) -> TickFilter
fn clone(&self) -> TickFilter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more