A comprehensive cryptocurrency trading system with real-time data collection, advanced backtesting capabilities, and a professional desktop interface.
Rust Trade combines high-performance market data processing with sophisticated backtesting tools, delivering a complete solution for cryptocurrency quantitative trading. The system features real-time data collection from exchanges, a powerful backtesting engine with multiple strategies, and an intuitive desktop interface.
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Exchange โโโโโถโ Service โโโโโถโ Repository โ
โ (WebSocket) โ โ (Processing) โ โ (Storage) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โผ โผ
Binance API โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
- Real-time data โ Multi-Level โ โ PostgreSQL โ
- Paper trading โ Cache โ โ Database โ
โ (L1 + L2) โ โ โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Paper Trading โ
โ Engine โ
โโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Next.js โโโโโถโ Tauri Commands โโโโโถโ Trading Common โ
โ Frontend โ โ (src-tauri) โ โ (Library) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Backtest Engine โ โ Repository โ
โ + Strategies โ โ + Database โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
rust-trade/
โโโ assets/ # Project assets and screenshots
โโโ config/ # Global configuration files
โ โโโ development.toml # Development environment config
โ โโโ production.toml # Production environment config
โ โโโ schema.sql # PostgreSQL table definitions
โ โโโ test.toml # Test environment config
โโโ frontend/ # Next.js frontend application
โ โโโ src/ # Frontend source code
โ โ โโโ app/ # App router pages
โ โ โ โโโ page.tsx # Dashboard homepage
โ โ โ โโโ backtest/ # Backtesting interface
โ โ โโโ components/ # Reusable UI components
โ โ โ โโโ layout/ # Layout components
โ โ โ โโโ ui/ # shadcn/ui components
โ โ โโโ types/ # TypeScript type definitions
โ โโโ tailwind.config.js # Tailwind CSS configuration
โ โโโ package.json # Frontend dependencies
โโโ src-tauri/ # Desktop application backend
โ โโโ src/ # Tauri command handlers and state management
โ โ โโโ commands.rs # Tauri command implementations
โ โ โโโ main.rs # Application entry point
โ โ โโโ state.rs # Application state management
โ โ โโโ types.rs # Frontend interface types
โ โโโ Cargo.toml # Tauri dependencies (uses trading-common)
โ โโโ tauri.conf.json # Tauri configuration
โโโ trading-common/ # Shared library for all crates
โ โโโ src/
โ โ โโโ backtest/ # Backtesting engine and strategies
โ โ โ โโโ engine.rs # Core backtesting logic
โ โ โ โโโ metrics.rs # Performance calculations
โ โ โ โโโ portfolio.rs # Portfolio management
โ โ โ โโโ strategy/ # Trading strategies (RSI, SMA)
โ โ โโโ data/ # Data layer
โ โ โ โโโ cache.rs # Multi-level caching system
โ โ โ โโโ repository.rs # Database operations
โ โ โ โโโ types.rs # Core data structures
โ โ โโโ lib.rs # Library entry point
โ โโโ Cargo.toml # Common dependencies
โโโ trading-core/ # CLI trading system
โ โโโ src/
โ โ โโโ exchange/ # Exchange integrations
โ โ โ โโโ binance.rs # Binance WebSocket client
โ โ โโโ live_trading/ # Paper trading system
โ โ โ โโโ paper_trading.rs # Real-time strategy execution
โ โ โโโ service/ # Business logic layer
โ โ โ โโโ market_data.rs # Data processing service
โ โ โโโ config.rs # Configuration management
โ โ โโโ lib.rs # Library entry point (re-exports trading-common)
โ โ โโโ main.rs # CLI application entry point
โ โโโ benches/ # Performance benchmarks
โ โโโ Cargo.toml # Core dependencies
โ โโโ README.md # Core system documentation
โโโ README.md # This file
- Rust 1.70+ - Install Rust
- Node.js 18+ - Install Node.js
- PostgreSQL 12+ - Install PostgreSQL
- Redis 6+ - Install Redis (optional but recommended)
git clone https://github.com/Erio-Harrison/rust-trade.git
cd rust-trade# Create database
createdb trading_core
# Set up schema
Run the SQL commands found in the config folder to create the database tables.Create .env files in both root directory and trading-core/:
# .env
DATABASE_URL=postgresql://username:password@localhost/trading_core
REDIS_URL=redis://127.0.0.1:6379
RUN_MODE=development# Install Rust dependencies
cd trading-core
cargo build
cd ..
# Install frontend dependencies
cd frontend
npm install
cd ..
# Install Tauri dependencies
cd src-tauri
cargo build
cd ..PS:
# Development mode with hot reload
cd frontend && npm run tauri dev
# or alternatively
cd frontend && cargo tauri dev
# Production build
cd frontend && npm run tauri build
# or alternatively
cd frontend && cargo tauri buildcd trading-core
# Start live data collection
cargo run live
# Start live data collection with paper trading
cargo run live --paper-trading
# Run backtesting interface
cargo run backtest
# Show help
cargo run -- --helpcd frontend
# Development server
npm run dev
# Production build
npm run build
npm start- Real-time WebSocket connections to cryptocurrency exchanges
- High-performance data processing (~390ยตs single insert, ~13ms batch)
- Multi-level caching with Redis and in-memory storage
- Automatic retry mechanisms and error handling
- Multiple trading strategies (SMA, RSI)
- Professional performance metrics (Sharpe ratio, drawdown, win rate)
- Portfolio management with P&L tracking
- Interactive parameter configuration
- Real-time data visualization
- Intuitive strategy configuration
- Comprehensive result analysis
- Cross-platform support (Windows, macOS, Linux)
Edit config/development.toml:
# Trading pairs to monitor
symbols = ["BTCUSDT", "ETHUSDT", "ADAUSDT"]
[server]
host = "0.0.0.0"
port = 8080
[database]
max_connections = 5
min_connections = 1
max_lifetime = 1800
[cache]
[cache.memory]
max_ticks_per_symbol = 1000
ttl_seconds = 300
[cache.redis]
pool_size = 10
ttl_seconds = 3600
max_ticks_per_symbol = 10000Set log levels via environment variables:
# Application logs
RUST_LOG=trading_core=info
# Debug mode
RUST_LOG=trading_core=debug,sqlx=infoBased on comprehensive benchmarks:
| Operation | Performance | Use Case |
|---|---|---|
| Single tick insert | ~390ยตs | Real-time data |
| Batch insert (100) | ~13ms | Bulk processing |
| Cache hit | ~10ยตs | Data retrieval |
| Historical query | ~450ยตs | Backtesting |
# Core system tests
cd trading-core
cargo test
# Benchmarks
cargo bench
# Frontend tests
cd frontend
npm test# Build trading core
cd trading-core
cargo build --release
# Build desktop app
cd ../frontend
npm run tauri build
# Build web interface
npm run build- Trading Core: See
trading-core/README.mdfor detailed backend documentation - Desktop App: See
src-tauri/README.mdfor Tauri application details
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Erio Harrison - GitHub
Built with โค๏ธ using Rust, Tauri, and Next.js


