pub struct PredicateFilter { /* private fields */ }Expand description
Pure post-fetch filter that accepts/rejects instruments via a closure.
Does not provide any slugs or query params: combine with source filters
via the provider’s with_filters() or add_filter() methods.
Implementations§
Source§impl PredicateFilter
impl PredicateFilter
Sourcepub fn new<F: Fn(&InstrumentAny) -> bool + Send + Sync + 'static>(
label: impl Into<String>,
predicate: F,
) -> Self
pub fn new<F: Fn(&InstrumentAny) -> bool + Send + Sync + 'static>( label: impl Into<String>, predicate: F, ) -> Self
Creates a new PredicateFilter with a label and closure predicate.
Sourcepub fn outcome(value: impl Into<String>) -> Self
pub fn outcome(value: impl Into<String>) -> Self
Convenience: keep only instruments with a matching outcome value.
Only [InstrumentAny::BinaryOption] instruments are checked; all other variants are rejected.
Sourcepub fn not_expired(now_ns: UnixNanos) -> Self
pub fn not_expired(now_ns: UnixNanos) -> Self
Convenience: reject instruments past expiration.
The caller provides the current time as [UnixNanos] so the filter
works correctly with both real-time and simulated (backtest) clocks.
Only [InstrumentAny::BinaryOption] instruments are checked; non-binary variants are accepted.
Trait Implementations§
Source§impl Debug for PredicateFilter
impl Debug for PredicateFilter
Source§impl InstrumentFilter for PredicateFilter
impl InstrumentFilter for PredicateFilter
Source§fn accept(&self, instrument: &InstrumentAny) -> bool
fn accept(&self, instrument: &InstrumentAny) -> bool
Post-fetch predicate: only instruments where this returns
true are kept.
Default accepts all instruments. Override to refine results after fetching.Source§fn market_slugs(&self) -> Option<Vec<String>>
fn market_slugs(&self) -> Option<Vec<String>>
Market slugs for concurrent per-slug fetching via
GET /markets?slug=.Source§fn event_slugs(&self) -> Option<Vec<String>>
fn event_slugs(&self) -> Option<Vec<String>>
Event slugs for fetching event containers via
GET /events?slug=.
Each event returns multiple markets.Source§fn query_params(&self) -> Option<GetGammaMarketsParams>
fn query_params(&self) -> Option<GetGammaMarketsParams>
Gamma API query params for bulk filtered fetching.
Source§fn event_queries(&self) -> Option<Vec<(String, GetGammaMarketsParams)>>
fn event_queries(&self) -> Option<Vec<(String, GetGammaMarketsParams)>>
Event queries with client-side sorting and limiting of embedded markets. Read more
Source§fn event_params(&self) -> Option<GetGammaEventsParams>
fn event_params(&self) -> Option<GetGammaEventsParams>
Gamma events API query params for fetching events with full filtering.
Source§fn search_params(&self) -> Option<GetSearchParams>
fn search_params(&self) -> Option<GetSearchParams>
Public search API params for text-based instrument discovery.
Source§fn accept_new_market(&self, new_market: &PolymarketNewMarket) -> bool
fn accept_new_market(&self, new_market: &PolymarketNewMarket) -> bool
Pre-fetch gate for new market WS events: returns
true if the market
should proceed to Gamma HTTP fetch. Used when this filter is set as
the dedicated new_market_filter in the data client config.
Default accepts all new markets.Auto Trait Implementations§
impl !RefUnwindSafe for PredicateFilter
impl !UnwindSafe for PredicateFilter
impl Freeze for PredicateFilter
impl Send for PredicateFilter
impl Sync for PredicateFilter
impl Unpin for PredicateFilter
impl UnsafeUnpin for PredicateFilter
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
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