pub trait DataFeed {
// Required methods
fn next_event(&mut self) -> Option<MarketEvent>;
fn peek(&self) -> Option<&MarketEvent>;
// Provided methods
fn next_batch(&mut self) -> Option<TimestampBatch> { ... }
fn total_events(&self) -> Option<usize> { ... }
}Expand description
Sequential source of market events for backtesting.
Required Methods§
Sourcefn next_event(&mut self) -> Option<MarketEvent>
fn next_event(&mut self) -> Option<MarketEvent>
Return the next event, or None when the feed is exhausted.
Sourcefn peek(&self) -> Option<&MarketEvent>
fn peek(&self) -> Option<&MarketEvent>
Peek at the next event without consuming it.
Provided Methods§
Sourcefn next_batch(&mut self) -> Option<TimestampBatch>
fn next_batch(&mut self) -> Option<TimestampBatch>
Return all contiguous events at the next timestamp.
Implementations with native metadata should override this method. The default preserves compatibility for custom feeds and assigns primary role metadata in their existing event order.
Sourcefn total_events(&self) -> Option<usize>
fn total_events(&self) -> Option<usize>
Total number of events when known without consuming the feed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".