Skip to main content

InstrumentProvider

Trait InstrumentProvider 

Source
pub trait InstrumentProvider {
    // Required methods
    fn store(&self) -> &InstrumentStore;
    fn store_mut(&mut self) -> &mut InstrumentStore;
    fn load_all<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        filters: Option<&'life1 HashMap<String, String>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        instrument_id: &'life1 InstrumentId,
        filters: Option<&'life2 HashMap<String, String>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn load_ids<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        instrument_ids: &'life1 [InstrumentId],
        filters: Option<&'life2 HashMap<String, String>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Provides instrument definitions from a venue.

Implementations define how instruments are fetched from a venue API. The store() / store_mut() accessors expose the underlying InstrumentStore so that callers can query cached instruments.

§Thread safety

Provider instances are not intended to be sent across threads. The ?Send bound allows implementations to hold non-Send state for Python interop.

Required Methods§

Source

fn store(&self) -> &InstrumentStore

Returns a reference to the provider’s instrument store.

Source

fn store_mut(&mut self) -> &mut InstrumentStore

Returns a mutable reference to the provider’s instrument store.

Source

fn load_all<'life0, 'life1, 'async_trait>( &'life0 mut self, filters: Option<&'life1 HashMap<String, String>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Loads all available instruments from the venue.

Implementations should populate the store via store_mut().add().

§Errors

Returns an error if the loading operation fails.

Source

fn load<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, instrument_id: &'life1 InstrumentId, filters: Option<&'life2 HashMap<String, String>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Loads a single instrument by its ID.

§Errors

Returns an error if the loading operation fails.

Provided Methods§

Source

fn load_ids<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, instrument_ids: &'life1 [InstrumentId], filters: Option<&'life2 HashMap<String, String>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Loads specific instruments by their IDs.

The default implementation calls load for each ID sequentially. Adapters with batch APIs should override this.

§Errors

Returns an error if any instrument fails to load.

Implementors§