pub trait MarketDataProvider: Send + Sync {
// Required methods
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: &'life1 [Symbol],
) -> Pin<Box<dyn Future<Output = Result<Receiver<MarketTick>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn unsubscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: &'life1 [Symbol],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_latest_quote<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 Symbol,
) -> Pin<Box<dyn Future<Output = Result<MarketTick>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_bars<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
symbol: &'life1 Symbol,
start: DateTime<Utc>,
end: DateTime<Utc>,
timeframe: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Bar>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_order_book<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 Symbol,
) -> Pin<Box<dyn Future<Output = Result<OrderBook>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn is_connected<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for market data providers (Alpaca, Polygon, IEX, etc.)
Implementations should handle connection management, authentication, and data normalization.
Required Methods§
Sourcefn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: &'life1 [Symbol],
) -> Pin<Box<dyn Future<Output = Result<Receiver<MarketTick>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: &'life1 [Symbol],
) -> Pin<Box<dyn Future<Output = Result<Receiver<MarketTick>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn unsubscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: &'life1 [Symbol],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unsubscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: &'life1 [Symbol],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Unsubscribe from market data for given symbols
Sourcefn get_latest_quote<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 Symbol,
) -> Pin<Box<dyn Future<Output = Result<MarketTick>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_latest_quote<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 Symbol,
) -> Pin<Box<dyn Future<Output = Result<MarketTick>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get latest quote for a symbol
Sourcefn get_bars<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
symbol: &'life1 Symbol,
start: DateTime<Utc>,
end: DateTime<Utc>,
timeframe: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Bar>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_bars<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
symbol: &'life1 Symbol,
start: DateTime<Utc>,
end: DateTime<Utc>,
timeframe: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Bar>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get historical bars for a symbol
§Arguments
symbol- Trading symbolstart- Start timestampend- End timestamptimeframe- Bar timeframe (e.g., “1Min”, “1Hour”, “1Day”)