| Crates.io | ccxt-rust |
| lib.rs | ccxt-rust |
| version | 0.1.3 |
| created_at | 2025-12-13 08:31:48.284589+00 |
| updated_at | 2026-01-22 04:45:25.957737+00 |
| description | Cryptocurrency exchange trading library in Rust |
| homepage | |
| repository | https://github.com/Praying/ccxt-rust |
| max_upload_size | |
| id | 1982722 |
| size | 4,504,552 |
A professional-grade, type-safe Rust implementation of the CCXT library for cryptocurrency trading, providing unified access to major exchanges.
| Exchange | Market Data | Trading | WebSocket |
|---|---|---|---|
| Binance | â | â | â |
| Bitget | â | â | â |
| Hyperliquid | â | â | â |
| OKX | â | â | â |
| Bybit | â | â | â |
Legend: â Supported, đ§ In Progress
Tokio and rust_decimal for safe, high-performance financial operations.Exchange trait across all supported exchanges.cargo add ccxt-rust
use ccxt_exchanges::binance::Binance;
use ccxt_core::exchange::Exchange;
use rust_decimal_macros::dec;
use ccxt_core::types::{OrderType, OrderSide};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Initialize (using env vars recommended)
let exchange = Binance::builder()
.api_key(std::env::var("BINANCE_API_KEY").ok())
.secret(std::env::var("BINANCE_SECRET").ok())
.build()?;
// 2. Fetch Market Data
let ticker = exchange.fetch_ticker("BTC/USDT").await?;
println!("BTC/USDT Price: {:?}", ticker.last);
// 3. Place Order (if credentials provided)
if exchange.has_private_api() {
let order = exchange.create_order(
"BTC/USDT",
OrderType::Limit,
OrderSide::Buy,
dec!(0.001),
Some(dec!(50000)),
).await?;
println!("Order placed: {}", order.id);
}
Ok(())
}
For WebSocket examples and advanced usage (polymorphism), see the examples/ directory.
The project is structured as a workspace:
ccxt-core: Defines the unified Exchange and WsExchange traits, standard types, and error handling logic.ccxt-exchanges: Contains specific implementations (Binance, OKX, etc.).| Flag | Description | Default |
|---|---|---|
rest |
REST API support | â |
websocket |
WebSocket support | â |
rustls-tls |
Use RustLS (recommended) | â |
native-tls |
Use OpenSSL/Native TLS | â |
# Run tests
cargo test
# Check code quality
cargo clippy --all-targets -- -D warnings
# Build documentation
cargo doc --open
MIT License. See LICENSE.
This project is for educational and research purposes only. The authors and contributors are not responsible for any financial losses or damages arising from the use of this software. Cryptocurrency trading involves high risk; please trade responsibly.
Status: đ§ Active Development (v0.1.3) | Donations (BSC): 0x8e5d858f92938b028065d39450421d0e080d15f7