Skip to main content

TickFilter

Struct TickFilter 

Source
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

Source

pub fn new() -> Self

Creates a new TickFilter with no predicates set (matches everything).

Source

pub fn symbol(self, s: Symbol) -> Self

Restrict matches to ticks with this symbol.

Source

pub fn side(self, s: Side) -> Self

Restrict matches to ticks on this side.

Source

pub fn min_quantity(self, q: Quantity) -> Self

Restrict matches to ticks with quantity >= q.

Source

pub fn max_quantity(self, q: Quantity) -> Self

Restrict matches to ticks with quantity <= q.

Source

pub fn min_price(self, p: Price) -> Self

Restrict matches to ticks with price >= p.

Source

pub fn max_price(self, p: Price) -> Self

Restrict matches to ticks with price <= p.

Source

pub fn min_notional(self, n: Decimal) -> Self

Restrict matches to ticks with notional (price * quantity) >= n.

Source

pub fn max_notional(self, n: Decimal) -> Self

Restrict matches to ticks with notional (price * quantity) <= n.

Source

pub fn timestamp_range(self, from: NanoTimestamp, to: NanoTimestamp) -> Self

Restrict matches to ticks whose timestamp falls within [from, to] (inclusive).

Source

pub fn has_symbol_filter(&self) -> bool

Returns true if a symbol predicate has been set on this filter.

Source

pub fn has_side_filter(&self) -> bool

Returns true if a side predicate has been set on this filter.

Source

pub fn has_min_qty_filter(&self) -> bool

Returns true if a minimum quantity predicate has been set on this filter.

Source

pub fn has_price_filter(&self) -> bool

Returns true if a price range predicate has been set on this filter.

Source

pub fn has_notional_filter(&self) -> bool

Returns true if a notional (min or max) predicate has been set on this filter.

Source

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.

Source

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.

Source

pub fn matches(&self, tick: &Tick) -> bool

Returns true if the tick satisfies all configured predicates.

Source

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

Source§

fn clone(&self) -> TickFilter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for TickFilter

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.