|
| 1 | +# Elite Self-Adaptive RL Bitcoin Trading Bot |
| 2 | + |
| 3 | +Institutional-grade, self-healing Reinforcement Learning trading system for Bitcoin with adaptive intelligence, automated overfitting detection, and premium visualizations. |
| 4 | + |
| 5 | +## Core Features |
| 6 | +- Adaptive Intelligence: Real-time monitor for divergence, variance explosion, and regime shifts |
| 7 | +- Multi-Model Ensemble: 10 diverse models with adaptive weighting |
| 8 | +- Long-Only Strategy: No shorting, only buy and hold positions |
| 9 | +- Advanced Features: 50+ indicators across 5 tiers (Technical, Microstructure, Meta, Time, Cross-Asset) |
| 10 | +- Institutional Reporting: Comprehensive Comet ML dashboards with 14+ graphs |
| 11 | +- Multi-Exchange Support: Fully integrated with Binance (via CCXT) and Alpaca |
| 12 | +- Automated Versioning: Sequential run numbering with automatic git tagging every 5 runs |
| 13 | + |
| 14 | +## Installation |
| 15 | + |
| 16 | +1. Clone the repository |
| 17 | + ```bash |
| 18 | + git clone https://github.com/MeridianAlgo/MidnightAI.git |
| 19 | + cd MidnightAI |
| 20 | + ``` |
| 21 | + |
| 22 | +2. Install dependencies |
| 23 | + ```bash |
| 24 | + pip install -r requirements.txt |
| 25 | + ``` |
| 26 | + |
| 27 | +3. Setup Environment - Create a `.env` file: |
| 28 | + ```env |
| 29 | + COMET_API_KEY=your_actual_comet_key |
| 30 | + COMET_PROJECT=midnight-rl |
| 31 | + BINANCE_API_KEY=your_key |
| 32 | + BINANCE_API_SECRET=your_secret |
| 33 | + ``` |
| 34 | + |
| 35 | +## Usage |
| 36 | + |
| 37 | +### Training |
| 38 | +```bash |
| 39 | +python src/main.py --mode train --initial-capital 10000 |
| 40 | +``` |
| 41 | + |
| 42 | +Training takes 30-40 minutes per run with 10 ensemble models. |
| 43 | + |
| 44 | +### Automated Schedule |
| 45 | +The system runs 10 times per day via GitHub Actions (every 2.4 hours). Results are committed and logged to Comet ML. |
| 46 | + |
| 47 | +## Project Structure |
| 48 | +- `src/`: Core logic (Agent, Env, Features, Protection) |
| 49 | +- `data/`: SQLite database and OHLCV storage |
| 50 | +- `reports/`: Interactive HTML dashboards |
| 51 | +- `models/`: Trained ensemble checkpoints (10 models) |
| 52 | +- `models/run_counter.txt`: Sequential run tracking |
| 53 | + |
| 54 | +## Ensemble Models |
| 55 | + |
| 56 | +The system trains 10 diverse models: |
| 57 | +1. PPO Aggressive (high exploration) |
| 58 | +2. PPO Conservative (low exploration) |
| 59 | +3. PPO Balanced |
| 60 | +4. A2C Fast |
| 61 | +5. A2C Stable |
| 62 | +6. DQN Discrete |
| 63 | +7. DQN Double |
| 64 | +8. Recurrent PPO |
| 65 | +9. Recurrent A2C |
| 66 | +10. TD3 Continuous (adapted for discrete) |
| 67 | + |
| 68 | +## Trading Strategy |
| 69 | + |
| 70 | +- **Long-Only**: Buy BTC with cash, sell BTC for cash, or hold |
| 71 | +- **No Shorting**: Cannot sell what you don't own |
| 72 | +- **Profit-Driven**: Heavy penalties for losses, bonuses for profits |
| 73 | +- **Action Distribution**: Balanced buy/sell/hold based on market conditions |
| 74 | + |
| 75 | +## Anti-Overfitting System |
| 76 | + |
| 77 | +The AdaptiveOverfitProtection monitors: |
| 78 | +- Train/Val Divergence |
| 79 | +- Confidence Collapse |
| 80 | +- Regime Drift |
| 81 | +- Variance Explosion |
| 82 | + |
| 83 | +## Comet ML Dashboards |
| 84 | + |
| 85 | +Each run generates 14 comprehensive graphs: |
| 86 | +1. Equity Curve (line with profit/loss zones) |
| 87 | +2. Drawdown Analysis (area chart) |
| 88 | +3. Cumulative Returns (line chart) |
| 89 | +4. Rolling Sharpe Ratio (line chart) |
| 90 | +5. Profit & Loss Over Time (area chart) |
| 91 | +6. Returns Distribution (histogram) |
| 92 | +7. Volatility Over Time (line chart) |
| 93 | +8. Underwater Plot (area chart) |
| 94 | +9. Daily Returns (bar chart) |
| 95 | +10. Model Performance Comparison (line chart) |
| 96 | +11. Ensemble Weights (horizontal bar) |
| 97 | +12. Actions Over Time (line chart) |
| 98 | +13. Confidence Bands (line with zones) |
| 99 | +14. Equity vs Benchmark (line comparison) |
| 100 | + |
| 101 | +## GitHub Actions |
| 102 | + |
| 103 | +Workflow runs 10x daily: |
| 104 | +- Every 2.4 hours (0:00, 2:24, 4:48, 7:12, 9:36, 12:00, 14:24, 16:48, 19:12, 21:36 UTC) |
| 105 | +- Creates milestone tags every 5 runs |
| 106 | +- Commits results automatically |
| 107 | +- Tracks run numbers across executions |
| 108 | + |
| 109 | +--- |
| 110 | +Built by Elite RL Trading Intelligence |
0 commit comments