pub trait DataClient:
Any
+ Sync
+ Send {
Show 51 methods
// Required methods
fn client_id(&self) -> ClientId;
fn venue(&self) -> Option<Venue>;
fn start(&mut self) -> Result<()>;
fn stop(&mut self) -> Result<()>;
fn reset(&mut self) -> Result<()>;
fn dispose(&mut self) -> Result<()>;
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_connected(&self) -> bool;
fn is_disconnected(&self) -> bool;
// Provided methods
fn subscribe(&mut self, cmd: &SubscribeCustomData) -> Result<()> { ... }
fn subscribe_instruments(
&mut self,
cmd: &SubscribeInstruments,
) -> Result<()> { ... }
fn subscribe_instrument(&mut self, cmd: &SubscribeInstrument) -> Result<()> { ... }
fn subscribe_book_deltas(&mut self, cmd: &SubscribeBookDeltas) -> Result<()> { ... }
fn subscribe_book_depth10(
&mut self,
cmd: &SubscribeBookDepth10,
) -> Result<()> { ... }
fn subscribe_book_snapshots(
&mut self,
cmd: &SubscribeBookSnapshots,
) -> Result<()> { ... }
fn subscribe_quotes(&mut self, cmd: &SubscribeQuotes) -> Result<()> { ... }
fn subscribe_trades(&mut self, cmd: &SubscribeTrades) -> Result<()> { ... }
fn subscribe_mark_prices(&mut self, cmd: &SubscribeMarkPrices) -> Result<()> { ... }
fn subscribe_index_prices(
&mut self,
cmd: &SubscribeIndexPrices,
) -> Result<()> { ... }
fn subscribe_bars(&mut self, cmd: &SubscribeBars) -> Result<()> { ... }
fn subscribe_instrument_status(
&mut self,
cmd: &SubscribeInstrumentStatus,
) -> Result<()> { ... }
fn subscribe_instrument_close(
&mut self,
cmd: &SubscribeInstrumentClose,
) -> Result<()> { ... }
fn subscribe_blocks(&mut self, cmd: &SubscribeBlocks) -> Result<()> { ... }
fn subscribe_pool(&mut self, cmd: &SubscribePool) -> Result<()> { ... }
fn subscribe_pool_swaps(&mut self, cmd: &SubscribePoolSwaps) -> Result<()> { ... }
fn subscribe_pool_liquidity_updates(
&mut self,
cmd: &SubscribePoolLiquidityUpdates,
) -> Result<()> { ... }
fn unsubscribe(&mut self, cmd: &UnsubscribeCustomData) -> Result<()> { ... }
fn unsubscribe_instruments(
&mut self,
cmd: &UnsubscribeInstruments,
) -> Result<()> { ... }
fn unsubscribe_instrument(
&mut self,
cmd: &UnsubscribeInstrument,
) -> Result<()> { ... }
fn unsubscribe_book_deltas(
&mut self,
cmd: &UnsubscribeBookDeltas,
) -> Result<()> { ... }
fn unsubscribe_book_depth10(
&mut self,
cmd: &UnsubscribeBookDepth10,
) -> Result<()> { ... }
fn unsubscribe_book_snapshots(
&mut self,
cmd: &UnsubscribeBookSnapshots,
) -> Result<()> { ... }
fn unsubscribe_quotes(&mut self, cmd: &UnsubscribeQuotes) -> Result<()> { ... }
fn unsubscribe_trades(&mut self, cmd: &UnsubscribeTrades) -> Result<()> { ... }
fn unsubscribe_mark_prices(
&mut self,
cmd: &UnsubscribeMarkPrices,
) -> Result<()> { ... }
fn unsubscribe_index_prices(
&mut self,
cmd: &UnsubscribeIndexPrices,
) -> Result<()> { ... }
fn unsubscribe_bars(&mut self, cmd: &UnsubscribeBars) -> Result<()> { ... }
fn unsubscribe_instrument_status(
&mut self,
cmd: &UnsubscribeInstrumentStatus,
) -> Result<()> { ... }
fn unsubscribe_instrument_close(
&mut self,
cmd: &UnsubscribeInstrumentClose,
) -> Result<()> { ... }
fn unsubscribe_blocks(&mut self, cmd: &UnsubscribeBlocks) -> Result<()> { ... }
fn unsubscribe_pool(&mut self, cmd: &UnsubscribePool) -> Result<()> { ... }
fn unsubscribe_pool_swaps(
&mut self,
cmd: &UnsubscribePoolSwaps,
) -> Result<()> { ... }
fn unsubscribe_pool_liquidity_updates(
&mut self,
cmd: &UnsubscribePoolLiquidityUpdates,
) -> Result<()> { ... }
fn request_data(&self, request: &RequestCustomData) -> Result<()> { ... }
fn request_instruments(&self, request: &RequestInstruments) -> Result<()> { ... }
fn request_instrument(&self, request: &RequestInstrument) -> Result<()> { ... }
fn request_book_snapshot(&self, request: &RequestBookSnapshot) -> Result<()> { ... }
fn request_quotes(&self, request: &RequestQuotes) -> Result<()> { ... }
fn request_trades(&self, request: &RequestTrades) -> Result<()> { ... }
fn request_bars(&self, request: &RequestBars) -> Result<()> { ... }
}
Expand description
Defines the interface for a data client, managing connections, subscriptions, and requests.
Required Methods§
Sourcefn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Returns true
if the client is currently connected.
Sourcefn is_disconnected(&self) -> bool
fn is_disconnected(&self) -> bool
Returns true
if the client is currently disconnected.
Provided Methods§
Sourcefn subscribe(&mut self, cmd: &SubscribeCustomData) -> Result<()>
fn subscribe(&mut self, cmd: &SubscribeCustomData) -> Result<()>
Subscribes to custom data types according to the command.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_instruments(&mut self, cmd: &SubscribeInstruments) -> Result<()>
fn subscribe_instruments(&mut self, cmd: &SubscribeInstruments) -> Result<()>
Subscribes to instruments list for the specified venue.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_instrument(&mut self, cmd: &SubscribeInstrument) -> Result<()>
fn subscribe_instrument(&mut self, cmd: &SubscribeInstrument) -> Result<()>
Subscribes to data for a single instrument.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_book_deltas(&mut self, cmd: &SubscribeBookDeltas) -> Result<()>
fn subscribe_book_deltas(&mut self, cmd: &SubscribeBookDeltas) -> Result<()>
Subscribes to order book delta updates for the specified instrument.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_book_depth10(&mut self, cmd: &SubscribeBookDepth10) -> Result<()>
fn subscribe_book_depth10(&mut self, cmd: &SubscribeBookDepth10) -> Result<()>
Subscribes to top 10 order book depth updates for the specified instrument.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_book_snapshots(
&mut self,
cmd: &SubscribeBookSnapshots,
) -> Result<()>
fn subscribe_book_snapshots( &mut self, cmd: &SubscribeBookSnapshots, ) -> Result<()>
Subscribes to periodic order book snapshots for the specified instrument.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_quotes(&mut self, cmd: &SubscribeQuotes) -> Result<()>
fn subscribe_quotes(&mut self, cmd: &SubscribeQuotes) -> Result<()>
Subscribes to quote updates for the specified instrument.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_trades(&mut self, cmd: &SubscribeTrades) -> Result<()>
fn subscribe_trades(&mut self, cmd: &SubscribeTrades) -> Result<()>
Subscribes to trade updates for the specified instrument.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_mark_prices(&mut self, cmd: &SubscribeMarkPrices) -> Result<()>
fn subscribe_mark_prices(&mut self, cmd: &SubscribeMarkPrices) -> Result<()>
Subscribes to mark price updates for the specified instrument.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_index_prices(&mut self, cmd: &SubscribeIndexPrices) -> Result<()>
fn subscribe_index_prices(&mut self, cmd: &SubscribeIndexPrices) -> Result<()>
Subscribes to index price updates for the specified instrument.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_bars(&mut self, cmd: &SubscribeBars) -> Result<()>
fn subscribe_bars(&mut self, cmd: &SubscribeBars) -> Result<()>
Subscribes to bar updates of the specified bar type.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_instrument_status(
&mut self,
cmd: &SubscribeInstrumentStatus,
) -> Result<()>
fn subscribe_instrument_status( &mut self, cmd: &SubscribeInstrumentStatus, ) -> Result<()>
Subscribes to status updates for the specified instrument.
§Errors
Returns an error if the subscribe operation fails.
Sourcefn subscribe_instrument_close(
&mut self,
cmd: &SubscribeInstrumentClose,
) -> Result<()>
fn subscribe_instrument_close( &mut self, cmd: &SubscribeInstrumentClose, ) -> Result<()>
Subscribes to instrument close events for the specified instrument.
§Errors
Returns an error if the subscription operation fails.
Sourcefn subscribe_blocks(&mut self, cmd: &SubscribeBlocks) -> Result<()>
fn subscribe_blocks(&mut self, cmd: &SubscribeBlocks) -> Result<()>
Subscribes to blocks for a specified blockchain.
§Errors
Returns an error if the subscription operation fails.
Sourcefn subscribe_pool(&mut self, cmd: &SubscribePool) -> Result<()>
fn subscribe_pool(&mut self, cmd: &SubscribePool) -> Result<()>
Subscribes to pool definition updates for a specified AMM pool.
§Errors
Returns an error if the subscription operation fails.
Sourcefn subscribe_pool_swaps(&mut self, cmd: &SubscribePoolSwaps) -> Result<()>
fn subscribe_pool_swaps(&mut self, cmd: &SubscribePoolSwaps) -> Result<()>
Subscribes to pool swaps for a specified AMM pool.
§Errors
Returns an error if the subscription operation fails.
Sourcefn subscribe_pool_liquidity_updates(
&mut self,
cmd: &SubscribePoolLiquidityUpdates,
) -> Result<()>
fn subscribe_pool_liquidity_updates( &mut self, cmd: &SubscribePoolLiquidityUpdates, ) -> Result<()>
Subscribes to pool liquidity updates for a specified AMM pool.
§Errors
Returns an error if the subscription operation fails.
Sourcefn unsubscribe(&mut self, cmd: &UnsubscribeCustomData) -> Result<()>
fn unsubscribe(&mut self, cmd: &UnsubscribeCustomData) -> Result<()>
Unsubscribes from custom data types according to the command.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_instruments(
&mut self,
cmd: &UnsubscribeInstruments,
) -> Result<()>
fn unsubscribe_instruments( &mut self, cmd: &UnsubscribeInstruments, ) -> Result<()>
Unsubscribes from instruments list for the specified venue.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_instrument(&mut self, cmd: &UnsubscribeInstrument) -> Result<()>
fn unsubscribe_instrument(&mut self, cmd: &UnsubscribeInstrument) -> Result<()>
Unsubscribes from data for the specified instrument.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_book_deltas(&mut self, cmd: &UnsubscribeBookDeltas) -> Result<()>
fn unsubscribe_book_deltas(&mut self, cmd: &UnsubscribeBookDeltas) -> Result<()>
Unsubscribes from order book delta updates for the specified instrument.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_book_depth10(
&mut self,
cmd: &UnsubscribeBookDepth10,
) -> Result<()>
fn unsubscribe_book_depth10( &mut self, cmd: &UnsubscribeBookDepth10, ) -> Result<()>
Unsubscribes from top 10 order book depth updates for the specified instrument.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_book_snapshots(
&mut self,
cmd: &UnsubscribeBookSnapshots,
) -> Result<()>
fn unsubscribe_book_snapshots( &mut self, cmd: &UnsubscribeBookSnapshots, ) -> Result<()>
Unsubscribes from periodic order book snapshots for the specified instrument.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_quotes(&mut self, cmd: &UnsubscribeQuotes) -> Result<()>
fn unsubscribe_quotes(&mut self, cmd: &UnsubscribeQuotes) -> Result<()>
Unsubscribes from quote updates for the specified instrument.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_trades(&mut self, cmd: &UnsubscribeTrades) -> Result<()>
fn unsubscribe_trades(&mut self, cmd: &UnsubscribeTrades) -> Result<()>
Unsubscribes from trade updates for the specified instrument.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_mark_prices(&mut self, cmd: &UnsubscribeMarkPrices) -> Result<()>
fn unsubscribe_mark_prices(&mut self, cmd: &UnsubscribeMarkPrices) -> Result<()>
Unsubscribes from mark price updates for the specified instrument.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_index_prices(
&mut self,
cmd: &UnsubscribeIndexPrices,
) -> Result<()>
fn unsubscribe_index_prices( &mut self, cmd: &UnsubscribeIndexPrices, ) -> Result<()>
Unsubscribes from index price updates for the specified instrument.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_bars(&mut self, cmd: &UnsubscribeBars) -> Result<()>
fn unsubscribe_bars(&mut self, cmd: &UnsubscribeBars) -> Result<()>
Unsubscribes from bar updates of the specified bar type.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_instrument_status(
&mut self,
cmd: &UnsubscribeInstrumentStatus,
) -> Result<()>
fn unsubscribe_instrument_status( &mut self, cmd: &UnsubscribeInstrumentStatus, ) -> Result<()>
Unsubscribes from instrument status updates for the specified instrument.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_instrument_close(
&mut self,
cmd: &UnsubscribeInstrumentClose,
) -> Result<()>
fn unsubscribe_instrument_close( &mut self, cmd: &UnsubscribeInstrumentClose, ) -> Result<()>
Unsubscribes from instrument close events for the specified instrument.
§Errors
Returns an error if the unsubscribe operation fails.
Sourcefn unsubscribe_blocks(&mut self, cmd: &UnsubscribeBlocks) -> Result<()>
fn unsubscribe_blocks(&mut self, cmd: &UnsubscribeBlocks) -> Result<()>
Unsubscribes from blocks for a specified blockchain.
§Errors
Returns an error if the subscription operation fails.
Sourcefn unsubscribe_pool(&mut self, cmd: &UnsubscribePool) -> Result<()>
fn unsubscribe_pool(&mut self, cmd: &UnsubscribePool) -> Result<()>
Unsubscribes from pool definition updates for a specified AMM pool.
§Errors
Returns an error if the subscription operation fails.
Sourcefn unsubscribe_pool_swaps(&mut self, cmd: &UnsubscribePoolSwaps) -> Result<()>
fn unsubscribe_pool_swaps(&mut self, cmd: &UnsubscribePoolSwaps) -> Result<()>
Unsubscribes from swaps for a specified AMM pool.
§Errors
Returns an error if the subscription operation fails.
Sourcefn unsubscribe_pool_liquidity_updates(
&mut self,
cmd: &UnsubscribePoolLiquidityUpdates,
) -> Result<()>
fn unsubscribe_pool_liquidity_updates( &mut self, cmd: &UnsubscribePoolLiquidityUpdates, ) -> Result<()>
Unsubscribes from pool liquidity updates for a specified AMM pool.
§Errors
Returns an error if the subscription operation fails.
Sourcefn request_data(&self, request: &RequestCustomData) -> Result<()>
fn request_data(&self, request: &RequestCustomData) -> Result<()>
Sourcefn request_instruments(&self, request: &RequestInstruments) -> Result<()>
fn request_instruments(&self, request: &RequestInstruments) -> Result<()>
Requests a list of instruments from the provider for a given venue.
§Errors
Returns an error if the instruments request fails.
Sourcefn request_instrument(&self, request: &RequestInstrument) -> Result<()>
fn request_instrument(&self, request: &RequestInstrument) -> Result<()>
Requests detailed data for a single instrument.
§Errors
Returns an error if the instrument request fails.
Sourcefn request_book_snapshot(&self, request: &RequestBookSnapshot) -> Result<()>
fn request_book_snapshot(&self, request: &RequestBookSnapshot) -> Result<()>
Requests a snapshot of the order book for a specified instrument.
§Errors
Returns an error if the book snapshot request fails.
Sourcefn request_quotes(&self, request: &RequestQuotes) -> Result<()>
fn request_quotes(&self, request: &RequestQuotes) -> Result<()>
Requests historical or streaming quote data for a specified instrument.
§Errors
Returns an error if the quotes request fails.
Sourcefn request_trades(&self, request: &RequestTrades) -> Result<()>
fn request_trades(&self, request: &RequestTrades) -> Result<()>
Requests historical or streaming trade data for a specified instrument.
§Errors
Returns an error if the trades request fails.
Sourcefn request_bars(&self, request: &RequestBars) -> Result<()>
fn request_bars(&self, request: &RequestBars) -> Result<()>
Requests historical or streaming bar data for a specified instrument and bar type.
§Errors
Returns an error if the bars request fails.