pub trait Exchange: Send + Sync {
Show 26 methods
// Required methods
fn id(&self) -> &str;
fn name(&self) -> &str;
fn capabilities(&self) -> ExchangeCapabilities;
fn fetch_markets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Market>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn load_markets<'life0, 'async_trait>(
&'life0 self,
reload: bool,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Market>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fetch_ticker<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Ticker>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_tickers<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: Option<&'life1 [String]>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Ticker>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_order_book<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<OrderBook>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Trade>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_ohlcv<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
timeframe: Timeframe,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Ohlcv>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_order<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
order_type: OrderType,
side: OrderSide,
amount: Decimal,
price: Option<Decimal>,
) -> Pin<Box<dyn Future<Output = Result<Order>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn cancel_order<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
symbol: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Order>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn cancel_all_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Order>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_order<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
symbol: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Order>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn fetch_open_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Order>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_closed_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Order>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_balance<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fetch_my_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Trade>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn market<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Market>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn markets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HashMap<String, Market>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn version(&self) -> &'static str { ... }
fn certified(&self) -> bool { ... }
fn has_websocket(&self) -> bool { ... }
fn timeframes(&self) -> Vec<Timeframe> { ... }
fn rate_limit(&self) -> f64 { ... }
fn is_symbol_active<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Core Exchange trait - the unified interface for all exchanges
This trait defines the standard API that all exchange implementations
must provide. It is designed to be object-safe for dynamic dispatch,
allowing exchanges to be used polymorphically via dyn Exchange.
§Thread Safety
All implementations must be Send + Sync to allow safe usage across
thread boundaries.
§Example
use ccxt_core::exchange::Exchange;
async fn print_exchange_info(exchange: &dyn Exchange) {
println!("Exchange: {} ({})", exchange.name(), exchange.id());
println!("Version: {}", exchange.version());
println!("Certified: {}", exchange.certified());
}Required Methods§
Sourcefn id(&self) -> &str
fn id(&self) -> &str
Returns the exchange identifier (e.g., “binance”, “coinbase”)
This is a lowercase, URL-safe identifier used internally.
Sourcefn capabilities(&self) -> ExchangeCapabilities
fn capabilities(&self) -> ExchangeCapabilities
Returns the exchange capabilities
Use this to check which features are supported before calling methods.
Sourcefn fetch_markets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Market>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch_markets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Market>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn load_markets<'life0, 'async_trait>(
&'life0 self,
reload: bool,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Market>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_markets<'life0, 'async_trait>(
&'life0 self,
reload: bool,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Market>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn fetch_ticker<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Ticker>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_ticker<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Ticker>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn fetch_tickers<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: Option<&'life1 [String]>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Ticker>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_tickers<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: Option<&'life1 [String]>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Ticker>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn fetch_order_book<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<OrderBook>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_order_book<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<OrderBook>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn fetch_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Trade>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Trade>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn fetch_ohlcv<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
timeframe: Timeframe,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Ohlcv>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_ohlcv<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
timeframe: Timeframe,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Ohlcv>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn create_order<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
order_type: OrderType,
side: OrderSide,
amount: Decimal,
price: Option<Decimal>,
) -> Pin<Box<dyn Future<Output = Result<Order>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_order<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 str,
order_type: OrderType,
side: OrderSide,
amount: Decimal,
price: Option<Decimal>,
) -> Pin<Box<dyn Future<Output = Result<Order>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new order
§Arguments
symbol- Trading pair symbolorder_type- Order type (limit, market, etc.)side- Order side (buy or sell)amount- Order amountprice- Optional price (required for limit orders)
§Returns
The created order.
§Errors
Returns an error if authentication fails or the order is invalid.
Sourcefn cancel_order<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
symbol: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Order>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn cancel_order<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
symbol: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Order>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn cancel_all_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Order>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel_all_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Order>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn fetch_order<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
symbol: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Order>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_order<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
symbol: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Order>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn fetch_open_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Order>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_open_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Order>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn fetch_closed_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Order>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_closed_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Order>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn fetch_balance<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch_balance<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn fetch_my_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Trade>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_my_trades<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: Option<&'life1 str>,
since: Option<i64>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Trade>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
Sourcefn certified(&self) -> bool
fn certified(&self) -> bool
Returns whether this exchange is CCXT certified
Certified exchanges have been thoroughly tested and verified.
Sourcefn has_websocket(&self) -> bool
fn has_websocket(&self) -> bool
Returns whether this exchange supports WebSocket (pro features)
Sourcefn timeframes(&self) -> Vec<Timeframe>
fn timeframes(&self) -> Vec<Timeframe>
Returns supported timeframes for OHLCV data
Sourcefn rate_limit(&self) -> f64
fn rate_limit(&self) -> f64
Returns the rate limit (requests per second)