Professional Algorithmic Trading Platform powered by QuantConnect LEAN Engine with integrated Smart Money Trading (SMT) concepts, AI/ML models, and comprehensive web dashboard.
- 🔧 Official QuantConnect LEAN Engine - Local execution, no API dependency
- 🤖 AI/ML Integration - Import/Export models (ONNX, TensorFlow, PyTorch, Scikit-learn)
- 📊 Smart Money Trading (SMT) - Order Blocks, Fair Value Gaps, Break of Structure
- 🌐 Web Dashboard - Complete broker management, portfolio analytics
- 🔗 Multi-Broker Support - Binance, Interactive Brokers, Paper Trading
- 🎛️ Advanced Risk Management - Position sizing, drawdown protection
- 📈 Real-time Monitoring - Live trading dashboard with P&L tracking
- 🔒 Security First - Encrypted credentials, rate limiting, SSL/TLS support
- ⚡ High Performance - Optimized Docker containers, caching, load balancing
- 🔄 CI/CD Ready - Automated testing, security scanning, deployment
graph TB
A[Nginx Proxy] --> B[React Frontend]
A --> C[Flask Backend]
A --> D[Jupyter Research]
A --> E[SMT Integration]
C --> F[LEAN Engine]
C --> G[PostgreSQL]
C --> H[Redis]
E --> I[ML Models]
E --> J[SMT Indicators]
F --> K[Algorithms]
F --> L[Data]
F --> M[Results]
style A fill:#3b82f6
style F fill:#10b981
style G fill:#8b5cf6
style H fill:#ef4444
| Component | Technology | Purpose |
|---|---|---|
| LEAN Engine | QuantConnect LEAN | Core trading engine |
| Frontend | React 18, TailwindCSS | Interactive dashboard |
| Backend | Flask, Python 3.11 | REST API server |
| Database | PostgreSQL 15 | Data persistence |
| Cache | Redis 7 | Real-time data cache |
| ML/AI | TensorFlow, PyTorch, ONNX | Model management |
| Proxy | Nginx | Load balancing, SSL |
| Research | Jupyter Lab | Algorithm development |
| Containers | Docker, Docker Compose | Orchestration |
- Docker and Docker Compose installed
- Git for repository cloning
- 4GB+ RAM recommended
- 10GB+ disk space for data and models
# Clone repository
git clone https://github.com/szarastrefa/lean-trading-bot-stack.git
cd lean-trading-bot-stack
# Make installer executable
chmod +x install.sh
# Run automated installation
./install.shAfter installation completes:
- 🌐 Dashboard: Your tunnel URL (displayed after install)
- 🔬 Research: Your_URL/research (Jupyter Lab)
- 🔗 API: Your_URL/api
- 📊 SMT API: Your_URL/smt
- 👤 Username: admin
- 🔑 Password: (randomly generated during install - displayed in terminal)
- 💾 Backup: Credentials saved to
~/.lean-bot-credentials-TIMESTAMP
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Restart single service
docker-compose restart webui-backend
# Update images
docker-compose pull && docker-compose up -d# Development mode with hot reload
docker-compose -f docker-compose.yml up -d
# Build specific service
docker-compose build webui-backend
# Run tests
docker-compose run --rm webui-backend python -m pytest- Place Python files in
algorithms/directory - Follow LEAN algorithm structure:
from AlgorithmImports import *
class MyStrategy(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 1, 1)
self.SetCash(100000)
self.AddEquity("SPY", Resolution.Hour)
def OnData(self, data):
if not self.Portfolio.Invested:
self.SetHoldings("SPY", 1)- Upload models via SMT API:
curl -X POST "http://localhost:8000/models/upload" \
-F "file=@model.pkl" \
-F 'metadata={"type":"classification","accuracy":0.85}'- Use in algorithms:
# In your LEAN algorithm
model_predictions = self.smt_api.predict("my_model", features)Key configuration options in .env:
# Core Settings
ENVIRONMENT=production
LEAN_MODE=BACKTESTING
# Security
ADMIN_PASSWORD=your_secure_password
FLASK_SECRET_KEY=your_secret_key
# Database
POSTGRES_PASSWORD=secure_db_password
REDIS_PASSWORD=secure_cache_password
# ML/AI
PERPLEXITY_API_KEY=your_ai_api_key
SMT_ENABLED=true
# Tunneling
TUNNEL_TYPE=localtunnel
TUNNEL_SUBDOMAIN=your-custom-name# Interactive Brokers
IB_ACCOUNT=your_ib_account
IB_USERNAME=your_username
IB_PASSWORD=your_password
IB_TRADING_MODE=paper
# Binance
BINANCE_API_KEY=your_api_key
BINANCE_API_SECRET=your_secret
BINANCE_TESTNET=true- Order Blocks: Institutional demand/supply zones
- Fair Value Gaps: Price imbalances for entries
- Break of Structure: Trend change identification
- Liquidity Zones: High-volume reversal areas
- Model Formats: ONNX, TensorFlow, PyTorch, Scikit-learn
- Real-time Predictions: Live trading integration
- Model Management: Upload, versioning, metadata
- Performance Tracking: Accuracy, confidence scores
- Portfolio Analytics: Real-time P&L, drawdown
- Algorithm Management: Start, stop, configure strategies
- Broker Integration: Multi-broker account management
- Risk Controls: Position sizing, stop losses
- Performance Reports: Backtests, live results
- 🔐 Encrypted Credentials: All secrets encrypted at rest
- 🛡️ Rate Limiting: API abuse prevention
- 🔍 Security Scanning: Automated vulnerability checks
- 🚦 Access Control: Role-based permissions
- 📝 Audit Logging: Complete action history
- 🔒 SSL/TLS: End-to-end encryption
- AWS/GCP/Azure: Use provided Terraform scripts
- DigitalOcean: One-click deployment available
- VPS: Manual Docker installation
- ✅ Automated Testing: Unit, integration, E2E tests
- 🔍 Security Scanning: Vulnerability assessments
- 📦 Docker Builds: Multi-arch container images
- 🚀 Auto Deployment: Zero-downtime updates
- ⚡ Response Time: < 100ms API responses
- 📊 Throughput: 1000+ requests/second
- 💾 Memory Usage: < 2GB typical operation
- 🔄 Uptime: 99.9% availability target
Port Conflicts:
# Check port usage
sudo netstat -tulpn | grep :5000
# Stop conflicting services
sudo systemctl stop apache2Docker Issues:
# Reset Docker
docker system prune -a
docker volume prune
# Restart services
docker-compose down && docker-compose up -dPermission Errors:
# Fix permissions
sudo chown -R $USER:$USER .
chmod +x install.sh- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push branch:
git push origin feature/amazing-feature - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- QuantConnect for the LEAN engine
- Smart Money Concepts community
- All contributors and beta testers
- 📧 Email: support@lean-trading-bot.com
- 💬 Discord: Join Community
- 📖 Documentation: Wiki
- 🐛 Issues: GitHub Issues
⭐ If this project helped you, please give it a star!
🚀 Happy Trading! 📈