pub trait Feeder:
Send
+ Sync
+ 'static
+ Debug {
type DepthMessage: Send + 'static;
type TradeMessage: Send + 'static;
// Required methods
fn start_feed_depth<'life0, 'async_trait>(
&'life0 self,
instrument_id: InstrumentId,
depth_rx: Receiver<Self::DepthMessage>,
options: Option<FeederOptions>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<OrderBookSnapshot>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stop_feed_depth<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn start_feed_trades<'life0, 'async_trait>(
&'life0 self,
instrument_id: InstrumentId,
trade_rx: Receiver<Self::TradeMessage>,
options: Option<FeederOptions>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<MarketTrade>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stop_feed_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn start_feed_bars<'life0, 'async_trait>(
&'life0 self,
instrument_id: InstrumentId,
bar_type: BarType,
trade_rx: Receiver<MarketTrade>,
options: Option<FeederOptions>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Bar>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stop_feed_bars<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
bar_type: &'life2 BarType,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_shared_orderbook<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<SharedSimdOrderBook>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_bar_cache<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
bar_type: &'life2 BarType,
max_bars: usize,
) -> Pin<Box<dyn Future<Output = Result<Arc<RwLock<BarCache>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn get_stats<'life0, 'life1, 'async_trait>(
&'life0 self,
_instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<FeedStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn reset_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
High-performance feeder interface for processing and normalizing exchange data Optimized for minimal allocations and low latency
Required Associated Types§
Sourcetype DepthMessage: Send + 'static
type DepthMessage: Send + 'static
Raw message type from the exchange for depth/orderbook
Sourcetype TradeMessage: Send + 'static
type TradeMessage: Send + 'static
Raw message type from the exchange for trades
Required Methods§
Sourcefn start_feed_depth<'life0, 'async_trait>(
&'life0 self,
instrument_id: InstrumentId,
depth_rx: Receiver<Self::DepthMessage>,
options: Option<FeederOptions>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<OrderBookSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start_feed_depth<'life0, 'async_trait>(
&'life0 self,
instrument_id: InstrumentId,
depth_rx: Receiver<Self::DepthMessage>,
options: Option<FeederOptions>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<OrderBookSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start processing and normalizing orderbook depth data Processes raw depth messages into standardized order book depth format
Sourcefn stop_feed_depth<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop_feed_depth<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stop processing orderbook depth data for a specific instrument
Sourcefn start_feed_trades<'life0, 'async_trait>(
&'life0 self,
instrument_id: InstrumentId,
trade_rx: Receiver<Self::TradeMessage>,
options: Option<FeederOptions>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<MarketTrade>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start_feed_trades<'life0, 'async_trait>(
&'life0 self,
instrument_id: InstrumentId,
trade_rx: Receiver<Self::TradeMessage>,
options: Option<FeederOptions>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<MarketTrade>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start processing and normalizing trade data Processes raw trade messages into standardized trade format
Sourcefn stop_feed_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop_feed_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stop processing trade data for a specific instrument
Sourcefn start_feed_bars<'life0, 'async_trait>(
&'life0 self,
instrument_id: InstrumentId,
bar_type: BarType,
trade_rx: Receiver<MarketTrade>,
options: Option<FeederOptions>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Bar>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start_feed_bars<'life0, 'async_trait>(
&'life0 self,
instrument_id: InstrumentId,
bar_type: BarType,
trade_rx: Receiver<MarketTrade>,
options: Option<FeederOptions>,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Bar>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start generating bars from trade data Aggregates trade data into OHLCV bars of the specified type
Sourcefn stop_feed_bars<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
bar_type: &'life2 BarType,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn stop_feed_bars<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
bar_type: &'life2 BarType,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stop generating bars for a specific instrument and bar type
Get a real-time shared orderbook for a specific instrument Returns a thread-safe shared orderbook that’s kept up-to-date
Sourcefn get_bar_cache<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
bar_type: &'life2 BarType,
max_bars: usize,
) -> Pin<Box<dyn Future<Output = Result<Arc<RwLock<BarCache>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_bar_cache<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instrument_id: &'life1 InstrumentId,
bar_type: &'life2 BarType,
max_bars: usize,
) -> Pin<Box<dyn Future<Output = Result<Arc<RwLock<BarCache>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get a bar cache for a specific instrument and bar type Returns a bar cache with recent bar data