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 Core │
│ Frontend │ │ (src-tauri) │ │ (Library) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
│ ▼
│ ┌─────────────────┐
│ │ Repository │
│ │ + Database │
│ └─────────────────┘
▼
┌─────────────────┐
│ Backtest Engine │
│ + Strategies │
└─────────────────┘
rust-trade/
├── assets/ # Project assets and screenshots
├── config/ # Global configuration files
│ ├── development.toml # Development environment config
│ ├── production.toml # Production environment config
│ └── 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
│ └── tauri.conf.json # Tauri configuration
├── trading-core/ # Core Rust trading system
│ ├── src/ # Trading engine source code
│ │ ├── 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
│ │ ├── 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
│ │ └── main.rs # CLI application entry point
│ ├── config/ # Configuration files
│ ├── database/ # Database schema and migrations
│ │ └── schema.sql # PostgreSQL table definitions
│ ├── 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


