pub struct ExchangeClient { /* private fields */ }Expand description
Unified exchange client that wraps per-capability trait objects.
Created by super::VenueRegistry::create_exchange_client. Provides
capability discovery and a convenience fetch_market_snapshot that
fetches all available data in parallel.
Implementations§
Source§impl ExchangeClient
impl ExchangeClient
Sourcepub fn from_descriptor(desc: &VenueDescriptor) -> Self
👎Deprecated since 0.8.0: pass the transport: use ExchangeClient::from_descriptor_with_http
pub fn from_descriptor(desc: &VenueDescriptor) -> Self
pass the transport: use ExchangeClient::from_descriptor_with_http
Build an ExchangeClient from a VenueDescriptor.
Each capability that exists in the descriptor gets a
ConfigurableExchangeClient implementation wired in.
Sourcepub fn from_descriptor_with_http(
desc: &VenueDescriptor,
http: Arc<dyn HttpClient>,
) -> Self
pub fn from_descriptor_with_http( desc: &VenueDescriptor, http: Arc<dyn HttpClient>, ) -> Self
Build an ExchangeClient from a VenueDescriptor whose requests go
through http.
Sourcepub fn venue_name(&self) -> &str
pub fn venue_name(&self) -> &str
Venue display name (e.g., “Binance Spot”).
Sourcepub fn venue_symbol(&self, pair: &Pair) -> String
pub fn venue_symbol(&self, pair: &Pair) -> String
The venue’s symbol for a pair; a pair with no quote uses the venue’s default quote.
Sourcepub fn has_order_book(&self) -> bool
pub fn has_order_book(&self) -> bool
Whether this client supports order book fetching.
Sourcepub fn has_ticker(&self) -> bool
pub fn has_ticker(&self) -> bool
Whether this client supports ticker fetching.
Sourcepub fn has_trade_history(&self) -> bool
pub fn has_trade_history(&self) -> bool
Whether this client supports trade history fetching.
Sourcepub async fn fetch_order_book(&self, pair: &str) -> Result<OrderBook>
pub async fn fetch_order_book(&self, pair: &str) -> Result<OrderBook>
Fetch order book (if supported).
Sourcepub async fn fetch_ticker(&self, pair: &str) -> Result<Ticker>
pub async fn fetch_ticker(&self, pair: &str) -> Result<Ticker>
Fetch ticker (if supported).
Sourcepub async fn fetch_recent_trades(
&self,
pair: &str,
limit: u32,
) -> Result<Vec<Trade>>
pub async fn fetch_recent_trades( &self, pair: &str, limit: u32, ) -> Result<Vec<Trade>>
Fetch recent trades (if supported).
Sourcepub fn lists_assets(&self) -> bool
pub fn lists_assets(&self) -> bool
Whether the venue lists its coins’ contracts (assets).
Sourcepub async fn fetch_assets(&self) -> Option<Result<Vec<AssetInfo>>>
pub async fn fetch_assets(&self) -> Option<Result<Vec<AssetInfo>>>
The venue’s coin list, or None when the venue has no assets
capability.
Sourcepub async fn fetch_token_addresses(
&self,
pair: &Pair,
) -> Option<Result<Vec<TokenAddress>>>
pub async fn fetch_token_addresses( &self, pair: &Pair, ) -> Option<Result<Vec<TokenAddress>>>
The token lines for pair from the venue’s coin list, or None
when the venue has no assets capability.
Sourcepub async fn fetch_ohlc(
&self,
pair: &str,
interval: &str,
limit: u32,
) -> Result<Vec<Candle>>
pub async fn fetch_ohlc( &self, pair: &str, interval: &str, limit: u32, ) -> Result<Vec<Candle>>
Fetch OHLC candlesticks (if supported).
Sourcepub async fn fetch_market_snapshot(
&self,
pair: &str,
trades_limit: u32,
) -> MarketSnapshot
pub async fn fetch_market_snapshot( &self, pair: &str, trades_limit: u32, ) -> MarketSnapshot
Fetch all available market data for a pair in one call, with up to
trades_limit recent trades.
Each capability is fetched independently; failures in one capability
do not prevent others from succeeding (they just produce None).