pub trait MarketDataProvider:
Send
+ Sync
+ 'static {
// Required methods
fn init<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
instruments: &'life1 [InstrumentId],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_best_bid_ask<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<(Decimal, Decimal)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_latest_trade_price<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_orderbook<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<OrderBook>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_recent_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<MarketTrade>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Interface for market data providers
Required Methods§
Sourcefn init<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn init<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initialize the provider
Sourcefn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
instruments: &'life1 [InstrumentId],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
instruments: &'life1 [InstrumentId],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Subscribe to market data for the specified instruments
Sourcefn get_best_bid_ask<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<(Decimal, Decimal)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_best_bid_ask<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<(Decimal, Decimal)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the best bid and ask for an instrument
Sourcefn get_latest_trade_price<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_latest_trade_price<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the latest trade price for an instrument
Sourcefn get_orderbook<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<OrderBook>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_orderbook<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<OrderBook>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the entire orderbook for an instrument
Sourcefn get_recent_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<MarketTrade>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_recent_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<MarketTrade>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get recent trades for an instrument