# ferr
> **Work in Progress** -- Currently in early development. Not ready for use.
[](https://docs.rs/ferr)
[](https://crates.io/crates/ferr)
[](LICENSE)
A Rust library for market data and order management on crypto CEXs.
## Supported Exchanges
| Bybit | Implemented | Implemented |
| Binance | Not yet implemented | Not yet implemented |
| OKX | Not yet implemented | Not yet implemented |
| Bitget | Not yet implemented | Not yet implemented |
## Features
### WebSocket Market Data
- Real-time trades, tickers, and orderbook (top of book)
- Funding rates and open interest
- Mark price and index price
- Automatic reconnection with exponential backoff
- Automatic subscription resumption after reconnect
- Broadcast channels for multi-consumer support
### REST API
- **Trading**: Place, modify, and cancel orders
- **Account**: Balance, positions, and trade history
- **Market Data**: Historical klines/OHLCV
### General
- Unified error types across all exchanges
- Rate limit tracking per exchange
- Testnet support
- Perpetual and spot markets (USDT pairs only)
## Example usage
```toml
[dependencies]
ferr = "0.1.11"
tokio = { version = "1.50.0", features = ["full"] }
```
### WebSocket: Stream Ticker Data
```rust
use ferr::{
exchanges::bybit::ws::client::BybitWsClient,
traits::ws::WsMarketData,
types::common::MarketType,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = BybitWsClient::new();
let mut rx = client.subscribe_ticker("BTCUSDT", MarketType::Perp).await?;
while let Ok(ticker) = rx.recv().await {
println!(
"{} | last: {} | bid: {} | ask: {}",
ticker.symbol, ticker.last, ticker.bid, ticker.ask
);
}
Ok(())
}
```