pub trait InstrumentFilter:
Debug
+ Send
+ Sync {
// Provided methods
fn market_slugs(&self) -> Option<Vec<String>> { ... }
fn event_slugs(&self) -> Option<Vec<String>> { ... }
fn query_params(&self) -> Option<GetGammaMarketsParams> { ... }
fn event_queries(&self) -> Option<Vec<(String, GetGammaMarketsParams)>> { ... }
fn event_params(&self) -> Option<GetGammaEventsParams> { ... }
fn search_params(&self) -> Option<GetSearchParams> { ... }
fn accept(&self, instrument: &InstrumentAny) -> bool { ... }
fn accept_new_market(&self, new_market: &PolymarketNewMarket) -> bool { ... }
}Expand description
Declarative filter for controlling which instruments are loaded.
All three methods default to None. At least one must return Some for
the filter to be useful. Methods are called on each load_all() cycle,
enabling dynamic re-evaluation (e.g., time-based slug generation).
Provided Methods§
Sourcefn market_slugs(&self) -> Option<Vec<String>>
fn market_slugs(&self) -> Option<Vec<String>>
Market slugs for concurrent per-slug fetching via GET /markets?slug=.
Sourcefn 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.
Sourcefn query_params(&self) -> Option<GetGammaMarketsParams>
fn query_params(&self) -> Option<GetGammaMarketsParams>
Gamma API query params for bulk filtered fetching.
Sourcefn 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.
Only order, ascending, and max_markets are supported. Other parameters
and unsupported order fields cause an error when loading. See
PolymarketGammaHttpClient::request_instruments_by_event_query.
Sourcefn event_params(&self) -> Option<GetGammaEventsParams>
fn event_params(&self) -> Option<GetGammaEventsParams>
Gamma events API query params for fetching events with full filtering.
Sourcefn search_params(&self) -> Option<GetSearchParams>
fn search_params(&self) -> Option<GetSearchParams>
Public search API params for text-based instrument discovery.
Sourcefn 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.
Sourcefn 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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".