Skip to main content

DataProvider

Trait DataProvider 

Source
pub trait DataProvider: Send + Sync {
    // Required methods
    fn load(&self, query: &DataQuery) -> Result<DataFrame, DataError>;
    fn has_data(&self, symbol: &str, timeframe: &Timeframe) -> bool;
    fn symbols(&self) -> Vec<String>;

    // Provided method
    fn timeframes(&self, symbol: &str) -> Vec<Timeframe> { ... }
}
Expand description

Trait for data providers

Implementations of this trait provide access to time series data. The trait is designed to be simple and synchronous - async operations should be handled by the implementation internally.

Required Methods§

Source

fn load(&self, query: &DataQuery) -> Result<DataFrame, DataError>

Load data matching the query

Returns a DataFrame with the requested data, or an error if the data is not available.

Source

fn has_data(&self, symbol: &str, timeframe: &Timeframe) -> bool

Check if data is available for a symbol/timeframe combination

Source

fn symbols(&self) -> Vec<String>

List available symbols

Provided Methods§

Source

fn timeframes(&self, symbol: &str) -> Vec<Timeframe>

List available timeframes for a symbol

Implementors§