Skip to main content

DataFeedAdapter

Trait DataFeedAdapter 

Source
pub trait DataFeedAdapter {
    type Error;

    // Required methods
    fn fetch_historical(
        &mut self,
        symbol: &str,
        timeframe: Timeframe,
        from: i64,
        to: i64,
    ) -> Result<Vec<Bar>, Self::Error>;
    fn subscribe_live(
        &mut self,
        symbol: &str,
        timeframe: Timeframe,
    ) -> Result<(), Self::Error>;
    fn poll_live(&mut self) -> Result<Vec<Bar>, Self::Error>;
}
Expand description

Historical/live bar data source contract. Provider clients (broker APIs, exchange WebSockets, vendor SDKs) live in consuming applications, not here.

Required Associated Types§

Required Methods§

Source

fn fetch_historical( &mut self, symbol: &str, timeframe: Timeframe, from: i64, to: i64, ) -> Result<Vec<Bar>, Self::Error>

Fetches historical bars for symbol at timeframe within [from, to] (Unix seconds).

Source

fn subscribe_live( &mut self, symbol: &str, timeframe: Timeframe, ) -> Result<(), Self::Error>

Registers interest in live updates for symbol/timeframe. A no-op for adapters that only ever serve historical data.

Source

fn poll_live(&mut self) -> Result<Vec<Bar>, Self::Error>

Returns any new bars received since the last call, for all subscribed symbols.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§