pub trait QuoteSource: Send + Sync {
// Required methods
fn poll_quotes<'life0, 'life1, 'async_trait>(
&'life0 self,
instruments: &'life1 [InstrumentId],
) -> Pin<Box<dyn Future<Output = Vec<Quote>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn last_quote(&self, instrument: &InstrumentId) -> Option<Quote>;
fn set_time(&mut self, time_ms: i64);
fn current_time_ms(&self) -> i64;
}Expand description
Trait for providing quote data.
This abstraction allows different quote sources to be plugged in:
- Mock quotes for testing
- Live quotes from real exchange
- Historical quotes from CSV
Required Methods§
Sourcefn poll_quotes<'life0, 'life1, 'async_trait>(
&'life0 self,
instruments: &'life1 [InstrumentId],
) -> Pin<Box<dyn Future<Output = Vec<Quote>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn poll_quotes<'life0, 'life1, 'async_trait>(
&'life0 self,
instruments: &'life1 [InstrumentId],
) -> Pin<Box<dyn Future<Output = Vec<Quote>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get current quotes for the given instruments
Sourcefn last_quote(&self, instrument: &InstrumentId) -> Option<Quote>
fn last_quote(&self, instrument: &InstrumentId) -> Option<Quote>
Get the last known quote for an instrument (if cached)
Sourcefn current_time_ms(&self) -> i64
fn current_time_ms(&self) -> i64
Get current time
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".