A Rust ecosystem for building high-performance algorithmic trading systems.
rustrade is a collection of Rust libraries for live-trading, paper-trading, and backtesting. It provides:
- Fast: Native Rust with minimal allocations. Data-oriented state management with O(1) lookups.
- Robust: Strongly typed, thread-safe, with extensive test coverage.
- Customisable: Plug-and-play Strategy and RiskManager components.
- Scalable: Multithreaded architecture leveraging Tokio for async I/O.
| Crate | Description |
|---|---|
rustrade |
Algorithmic trading engine with state management |
rustrade-data |
Stream public market data from exchanges |
rustrade-execution |
Stream account data and execute orders |
rustrade-instrument |
Exchange, instrument, and asset data structures |
rustrade-integration |
Low-level REST/WebSocket integration framework |
| Exchange | Market Data | Execution | Notes |
|---|---|---|---|
| Binance | ✅ Spot, USD-M Futures | ✅ Spot, Margin (cross/isolated) | WebSocket + REST |
| Alpaca | ✅ Equities (IEX/SIP), Crypto, Options | ✅ Equities, Options, Crypto | WebSocket + REST |
| Hyperliquid | ✅ Perps, Spot | ✅ Perps, Spot | WebSocket + REST |
| Interactive Brokers | ✅ Equities, Futures, Options | ✅ Equities, Futures, Options, Forex | TWS/Gateway API |
| Bitfinex | ✅ Spot | ❌ | WebSocket |
| BitMEX | ✅ Perpetual | ❌ | WebSocket |
| Bybit | ✅ Spot, Perpetual | ❌ | WebSocket |
| Coinbase | ✅ Spot | ❌ | WebSocket |
| Gate.io | ✅ Spot, Futures, Perpetual, Options | ❌ | WebSocket |
| Kraken | ✅ Spot | ❌ | WebSocket |
| OKX | ✅ Spot, Futures, Perpetual, Options | ❌ | WebSocket |
An exchange with no execution client is market-data only. See
rustrade-data for the exact connector types and subscription
kinds each one serves, and rustrade-execution for the order
types each execution client accepts.
| Provider | Asset Classes | Notes |
|---|---|---|
| Massive | Stocks, Crypto, Forex, Options, Futures | Historical + live streaming (Futures historical only) |
| Databento | Equities, Futures, Options | Nanosecond precision, DBN format |
| London Strategic Edge | FX, Crypto, Equities/ETFs, Options, Futures proxies, CFDs | Live ticks, historical candles, bulk export. |
⚠️ London Strategic Edge data is NOT redistributable. This integration's code is MIT like the rest of the repository; the data it retrieves is not. LSE permits use for your own research, trading and model training — including commercially — but prohibits redistributing, reselling, or otherwise making the data available to third parties, in bulk or through any competing feed, download service or interface. Do not commit retrieved data, publish it as fixtures or example datasets, or re-serve it. Terms: https://londonstrategicedge.com/terms
Add to your Cargo.toml:
[dependencies]
rustrade = "0.16"
rustrade-data = { version = "0.16", features = ["hyperliquid"] }
rustrade-execution = { version = "0.16", features = ["binance"] }See the examples for complete working code.
Rust 1.95 or later.
This software is for educational purposes only. USE THE SOFTWARE AT YOUR OWN RISK. THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR TRADING RESULTS.
This project is a fork of barter-rs, originally developed by Just A Stream, Inc. and the Barter Ecosystem Contributors. See NOTICE for full attribution.
Fork history:
- Original: barter-rs/barter-rs
- Intermediate: Niqnil/barter-rs
- Current: Niqnil/rustrade
Check the API Documentation. If your question isn't answered there, open a Discussion on GitHub.
Contributions welcome! Please open a PR targeting the develop branch. See CONTRIBUTING.md.
MIT License. See LICENSE.