pub trait ExchangeIdentity: Send + Sync {
// Required methods
fn exchange_id(&self) -> ExchangeId;
fn is_testnet(&self) -> bool;
fn supported_account_types(&self) -> Vec<AccountType>;
// Provided methods
fn exchange_name(&self) -> &'static str { ... }
fn exchange_type(&self) -> ExchangeType { ... }
fn metrics(&self) -> ConnectorStats { ... }
fn rate_limit_capabilities(&self) -> RateLimitCapabilities { ... }
fn orderbook_capabilities(
&self,
account_type: AccountType,
) -> OrderbookCapabilities { ... }
}Expand description
Базовая идентификация биржи
Этот трейт определяет минимальный набор методов для идентификации биржи. Все коннекторы ДОЛЖНЫ реализовывать этот трейт.
§Примечания
- НЕ требует авторизации
- Все методы синхронные (не async)
- Должен быть Send + Sync для многопоточного использования
Required Methods§
Sourcefn exchange_id(&self) -> ExchangeId
fn exchange_id(&self) -> ExchangeId
Уникальный идентификатор биржи
§Возвращает
ExchangeId enum значение (Binance, Bybit, OKX, Hyperliquid, etc.)
Sourcefn is_testnet(&self) -> bool
fn is_testnet(&self) -> bool
Sourcefn supported_account_types(&self) -> Vec<AccountType>
fn supported_account_types(&self) -> Vec<AccountType>
Список поддерживаемых типов аккаунтов
§Примеры
- Binance: [Spot, Margin, FuturesCross, FuturesIsolated]
- Bybit: [Spot, FuturesCross, FuturesIsolated]
- OKX: [Spot, Margin, FuturesCross, FuturesIsolated]
- Hyperliquid: [Spot, FuturesCross]
Provided Methods§
Sourcefn exchange_name(&self) -> &'static str
fn exchange_name(&self) -> &'static str
Sourcefn exchange_type(&self) -> ExchangeType
fn exchange_type(&self) -> ExchangeType
Тип биржи (централизованная, децентрализованная, гибрид)
§Дефолтная реализация
Делегирует в exchange_id().exchange_type()
Sourcefn metrics(&self) -> ConnectorStats
fn metrics(&self) -> ConnectorStats
Runtime metrics snapshot for this connector.
Returns HTTP request/error counters, last latency, and rate-limiter
utilization. The default implementation returns zeroed metrics.
Override this in connectors that have an HttpClient to expose live data.
Sourcefn rate_limit_capabilities(&self) -> RateLimitCapabilities
fn rate_limit_capabilities(&self) -> RateLimitCapabilities
Static rate limit capabilities for this exchange.
Returns the compile-time descriptor used to build runtime limiters.
Default is permissive() (unlimited) — override in each connector.
Sourcefn orderbook_capabilities(
&self,
account_type: AccountType,
) -> OrderbookCapabilities
fn orderbook_capabilities( &self, account_type: AccountType, ) -> OrderbookCapabilities
Static L2 orderbook capabilities for the given account type.
Describes REST depth limits, WebSocket channels, checksum support, etc.
Default is permissive() (unlimited) — override in each connector.