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§
Sourcefn fetch_historical(
&mut self,
symbol: &str,
timeframe: Timeframe,
from: i64,
to: i64,
) -> Result<Vec<Bar>, Self::Error>
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).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".