pub struct DataClientAdapter {Show 21 fields
pub client_id: ClientId,
pub venue: Option<Venue>,
pub handles_book_deltas: bool,
pub handles_book_snapshots: bool,
pub subscriptions_custom: AHashSet<DataType>,
pub subscriptions_book_deltas: AHashSet<InstrumentId>,
pub subscriptions_book_depth10: AHashSet<InstrumentId>,
pub subscriptions_book_snapshots: AHashSet<InstrumentId>,
pub subscriptions_quotes: AHashSet<InstrumentId>,
pub subscriptions_trades: AHashSet<InstrumentId>,
pub subscriptions_bars: AHashSet<BarType>,
pub subscriptions_instrument_status: AHashSet<InstrumentId>,
pub subscriptions_instrument_close: AHashSet<InstrumentId>,
pub subscriptions_instrument: AHashSet<InstrumentId>,
pub subscriptions_instrument_venue: AHashSet<Venue>,
pub subscriptions_mark_prices: AHashSet<InstrumentId>,
pub subscriptions_index_prices: AHashSet<InstrumentId>,
pub subscriptions_blocks: AHashSet<Blockchain>,
pub subscriptions_pools: AHashSet<Address>,
pub subscriptions_pool_swaps: AHashSet<Address>,
pub subscriptions_pool_liquidity_updates: AHashSet<Address>,
/* private fields */
}
Expand description
Wraps a DataClient
, managing subscription state and forwarding commands.
Fields§
§client_id: ClientId
§venue: Option<Venue>
§handles_book_deltas: bool
§handles_book_snapshots: bool
§subscriptions_custom: AHashSet<DataType>
§subscriptions_book_deltas: AHashSet<InstrumentId>
§subscriptions_book_depth10: AHashSet<InstrumentId>
§subscriptions_book_snapshots: AHashSet<InstrumentId>
§subscriptions_quotes: AHashSet<InstrumentId>
§subscriptions_trades: AHashSet<InstrumentId>
§subscriptions_bars: AHashSet<BarType>
§subscriptions_instrument_status: AHashSet<InstrumentId>
§subscriptions_instrument_close: AHashSet<InstrumentId>
§subscriptions_instrument: AHashSet<InstrumentId>
§subscriptions_instrument_venue: AHashSet<Venue>
§subscriptions_mark_prices: AHashSet<InstrumentId>
§subscriptions_index_prices: AHashSet<InstrumentId>
§subscriptions_blocks: AHashSet<Blockchain>
§subscriptions_pools: AHashSet<Address>
§subscriptions_pool_swaps: AHashSet<Address>
§subscriptions_pool_liquidity_updates: AHashSet<Address>
Implementations§
Source§impl DataClientAdapter
impl DataClientAdapter
Sourcepub fn new(
client_id: ClientId,
venue: Option<Venue>,
handles_order_book_deltas: bool,
handles_order_book_snapshots: bool,
client: Box<dyn DataClient>,
) -> Self
pub fn new( client_id: ClientId, venue: Option<Venue>, handles_order_book_deltas: bool, handles_order_book_snapshots: bool, client: Box<dyn DataClient>, ) -> Self
Creates a new DataClientAdapter
with the given client and clock.
pub fn get_client(&self) -> &Box<dyn DataClient>
pub fn execute_subscribe(&mut self, cmd: &SubscribeCommand)
pub fn execute_defi_subscribe(&mut self, cmd: &DefiSubscribeCommand)
pub fn execute_unsubscribe(&mut self, cmd: &UnsubscribeCommand)
pub fn execute_defi_unsubscribe(&mut self, cmd: &DefiUnsubscribeCommand)
Sourcepub fn subscribe(&mut self, cmd: &SubscribeCustomData) -> Result<()>
pub fn subscribe(&mut self, cmd: &SubscribeCustomData) -> Result<()>
Subscribes to a custom data type, updating internal state and forwarding to the client.
§Errors
Returns an error if the underlying client subscribe operation fails.
Sourcepub fn unsubscribe(&mut self, cmd: &UnsubscribeCustomData) -> Result<()>
pub fn unsubscribe(&mut self, cmd: &UnsubscribeCustomData) -> Result<()>
Unsubscribes from a custom data type, updating internal state and forwarding to the client.
§Errors
Returns an error if the underlying client unsubscribe operation fails.
Sourcepub fn request_data(&self, req: &RequestCustomData) -> Result<()>
pub fn request_data(&self, req: &RequestCustomData) -> Result<()>
Sends a data request to the underlying client.
§Errors
Returns an error if the client request fails.
Sourcepub fn request_instrument(&self, req: &RequestInstrument) -> Result<()>
pub fn request_instrument(&self, req: &RequestInstrument) -> Result<()>
Sends a single instrument request to the client.
§Errors
Returns an error if the client fails to process the request.
Sourcepub fn request_instruments(&self, req: &RequestInstruments) -> Result<()>
pub fn request_instruments(&self, req: &RequestInstruments) -> Result<()>
Sends a batch instruments request to the client.
§Errors
Returns an error if the client fails to process the request.
Sourcepub fn request_quotes(&self, req: &RequestQuotes) -> Result<()>
pub fn request_quotes(&self, req: &RequestQuotes) -> Result<()>
Sends a quotes request for a given instrument.
§Errors
Returns an error if the client fails to process the quotes request.
Sourcepub fn request_trades(&self, req: &RequestTrades) -> Result<()>
pub fn request_trades(&self, req: &RequestTrades) -> Result<()>
Sends a trades request for a given instrument.
§Errors
Returns an error if the client fails to process the trades request.
Sourcepub fn request_bars(&self, req: &RequestBars) -> Result<()>
pub fn request_bars(&self, req: &RequestBars) -> Result<()>
Sends a bars request for a given instrument and bar type.
§Errors
Returns an error if the client fails to process the bars request.
Trait Implementations§
Source§impl Debug for DataClientAdapter
impl Debug for DataClientAdapter
Source§impl Deref for DataClientAdapter
impl Deref for DataClientAdapter
Auto Trait Implementations§
impl Freeze for DataClientAdapter
impl !RefUnwindSafe for DataClientAdapter
impl Send for DataClientAdapter
impl Sync for DataClientAdapter
impl Unpin for DataClientAdapter
impl !UnwindSafe for DataClientAdapter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more