Skip to main content

DataFeed

Trait DataFeed 

Source
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§

Source

fn next_event(&mut self) -> Option<MarketEvent>

Return the next event, or None when the feed is exhausted.

Source

fn peek(&self) -> Option<&MarketEvent>

Peek at the next event without consuming it.

Provided Methods§

Source

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.

Source

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".

Implementors§