|
| 1 | +# Trading Automation Enhanced |
| 2 | + |
| 3 | +Advanced cryptocurrency trading bot with intelligent momentum detection and multi-timeframe analysis. |
| 4 | + |
| 5 | +## 📁 Project Structure |
| 6 | + |
| 7 | +### Main Trading System |
| 8 | + |
| 9 | +| File/Directory | Description | |
| 10 | +|----------------------------|----------------------------------------------| |
| 11 | +| `Trading-Automation/` | Core trading automation system | |
| 12 | +| ├─ `trading_automation.py` | Main trading bot with enhanced momentum detection | |
| 13 | +| ├─ `update_symbols.py` | Symbol fetcher and market data updater | |
| 14 | +| ├─ `secrets.py` | API keys and configuration | |
| 15 | +| `symbols.yaml` | USDC trading pairs and market data | |
| 16 | +| `trading.service` | Linux systemd service configuration | |
| 17 | +| `symbols_update.service` | Service for automatic symbol updates | |
| 18 | + |
| 19 | +### Research & Analysis Tools |
| 20 | + |
| 21 | +| File | Description | |
| 22 | +|----------------------------|----------------------------------------------| |
| 23 | +| `Research/` | Independent momentum analysis tools | |
| 24 | +| ├─ `momentum_analyzer.py` | Console-based momentum analysis (no deps) | |
| 25 | +| ├─ `momentum_visualizer.py`| Graphical momentum analysis (matplotlib) | |
| 26 | +| ├─ `requirements_viz.txt` | Dependencies for visualization tools | |
| 27 | +| └─ `README.md` | Detailed research tools documentation | |
| 28 | + |
| 29 | +## 🚀 Quick Start |
| 30 | + |
| 31 | +### Prerequisites |
| 32 | + |
| 33 | +```bash |
| 34 | +pip install python-telegram-bot==22.2 |
| 35 | +``` |
| 36 | + |
| 37 | +### Setup Process |
| 38 | + |
| 39 | +1. **Generate symbols.yaml** - Update trading pairs and market data |
| 40 | +2. **Configure API keys** - Set up Binance and Telegram credentials in `secrets.py` |
| 41 | +3. **Run the bot** - Start the main trading automation |
| 42 | +4. **Keep symbol updater running** - Maintain fresh market data |
| 43 | + |
| 44 | +### Research Tools |
| 45 | + |
| 46 | +```bash |
| 47 | +cd Research |
| 48 | +python momentum_analyzer.py # Console analysis (no dependencies) |
| 49 | +pip install -r requirements_viz.txt # Install visualization dependencies |
| 50 | +python momentum_visualizer.py # Graphical analysis |
| 51 | +``` |
| 52 | + |
| 53 | +## 🧠 Enhanced Momentum Detection System |
| 54 | + |
| 55 | +The bot now features an intelligent, adaptive momentum detection system that automatically adjusts to market conditions: |
| 56 | + |
| 57 | +### Key Features |
| 58 | + |
| 59 | +- **ATR-Based Dynamic Thresholds**: Automatically adapts sensitivity based on market volatility |
| 60 | +- **Multi-Timeframe Confirmation**: Requires signals across 1m, 5m, and 15m timeframes |
| 61 | +- **Multi-Indicator Fusion**: Combines price momentum, RSI, volume spikes, and MA crossovers |
| 62 | +- **Symbol-Specific Calibration**: Different thresholds for BTC, ETH, and altcoins |
| 63 | +- **Safety Bounds**: Floor and cap values ensure stability across all market conditions |
| 64 | + |
| 65 | +### Volume Thresholds by Asset |
| 66 | + |
| 67 | +- **BTC**: 660 USDC minimum volume |
| 68 | +- **ETH**: 500,000 USDC minimum volume |
| 69 | +- **Other pairs**: 300,000 USDC minimum volume |
| 70 | + |
| 71 | +### Adaptive Threshold Parameters |
| 72 | + |
| 73 | +| Timeframe | ATR Multiplier | Floor Threshold | Cap Threshold | |
| 74 | +|-----------|----------------|-----------------|---------------| |
| 75 | +| 1m | 0.55 | 0.070% | 1.5% | |
| 76 | +| 5m | 0.70 | 0.100% | 1.8% | |
| 77 | +| 15m | 0.85 | 0.150% | 2.0% | |
| 78 | + |
| 79 | +## 📈 Trading Strategy |
| 80 | + |
| 81 | +### Entry Conditions |
| 82 | + |
| 83 | +The bot considers buying only when ALL of the following conditions are met: |
| 84 | + |
| 85 | +- **Multi-timeframe momentum**: Positive momentum detected across 1m, 5m, and 15m timeframes |
| 86 | +- **Volume confirmation**: Trading volume exceeds minimum thresholds for the asset class |
| 87 | +- **Multi-indicator confluence**: Price momentum plus at least one additional indicator (RSI, volume spike, or MA crossover) |
| 88 | +- **Dynamic threshold validation**: Price changes exceed ATR-based adaptive thresholds |
| 89 | + |
| 90 | +### Exit Strategy |
| 91 | + |
| 92 | +The bot employs a sophisticated exit system: |
| 93 | + |
| 94 | +- **Trailing stop loss**: Automatically adjusts stop levels as price moves favorably |
| 95 | +- **Maximum hold time**: Prevents indefinite position holding in sideways markets |
| 96 | +- **Rapid reversal protection**: Quick exit on sharp price reversals to minimize losses |
| 97 | + |
| 98 | +### Risk Management |
| 99 | + |
| 100 | +- **Position sizing**: Calculated based on account balance and risk parameters |
| 101 | +- **Asset-specific limits**: Different volume requirements for major vs minor pairs |
| 102 | +- **Volatility adaptation**: Threshold sensitivity adjusts to current market conditions |
| 103 | + |
| 104 | +## 📊 Performance Characteristics |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +The system is designed to: |
| 109 | + |
| 110 | +- **Catch strong trends**: Enter during clear upward momentum phases |
| 111 | +- **Avoid false signals**: Multi-timeframe confirmation reduces noise |
| 112 | +- **Adapt to volatility**: Dynamic thresholds prevent over-trading in choppy markets |
| 113 | +- **Exit efficiently**: Trailing stops and time limits protect profits |
| 114 | + |
| 115 | +## ⚙️ Configuration & Tuning |
| 116 | + |
| 117 | +### Micro-Scalping Optimization |
| 118 | + |
| 119 | +For high-frequency trading scenarios: |
| 120 | + |
| 121 | +**Threshold Multipliers (k)**: |
| 122 | + |
| 123 | +- Start with k≈0.55–0.65 for 1m |
| 124 | +- Use k≈0.7–0.8 for 5m |
| 125 | +- Set k≈0.85–1.0 for 15m |
| 126 | + |
| 127 | +**Sensitivity Adjustments**: |
| 128 | + |
| 129 | +- **Too many entries**: Increase k values or floor thresholds |
| 130 | +- **Missing clean moves**: Decrease k slightly on 1m/5m timeframes |
| 131 | +- **Volatile spikes**: Keep cap thresholds ≤ 2% to avoid waiting indefinitely |
| 132 | + |
| 133 | +**Exit Optimization**: |
| 134 | + |
| 135 | +- Consider reducing MIN_PROFIT to ~0.8% for faster fills |
| 136 | +- Tighten TRAIL_STOP to ~0.5% if spreads are tight |
| 137 | +- Monitor slippage on rapid reversals |
| 138 | + |
| 139 | +## 🔬 Research & Analysis |
| 140 | + |
| 141 | +The `Research/` directory contains powerful tools for analyzing and understanding the momentum detection system: |
| 142 | + |
| 143 | +### Console Analyzer |
| 144 | + |
| 145 | +```bash |
| 146 | +python Research/momentum_analyzer.py |
| 147 | +``` |
| 148 | + |
| 149 | +- Zero external dependencies |
| 150 | +- Reproduces exact trading bot logic |
| 151 | +- Multi-symbol comparison |
| 152 | +- Threshold adaptation demonstration |
| 153 | + |
| 154 | +### Graphical Visualizer |
| 155 | + |
| 156 | +```bash |
| 157 | +pip install -r Research/requirements_viz.txt |
| 158 | +python Research/momentum_visualizer.py |
| 159 | +``` |
| 160 | + |
| 161 | +- Interactive matplotlib charts |
| 162 | +- Visual threshold analysis |
| 163 | +- Market condition scenarios |
| 164 | +- Performance comparison plots |
| 165 | + |
| 166 | +### Benefits |
| 167 | + |
| 168 | +- **No manual tuning required**: System automatically adapts to market conditions |
| 169 | +- **Consistent performance**: Works effectively across different asset classes |
| 170 | +- **Noise filtering**: Multi-timeframe approach reduces false signals |
| 171 | +- **Market adaptive**: Real-time threshold calculation based on recent volatility |
| 172 | + |
| 173 | +## 🛠️ System Requirements |
| 174 | + |
| 175 | +### Dependencies |
| 176 | + |
| 177 | +```bash |
| 178 | +pip install python-telegram-bot==22.2 |
| 179 | +``` |
| 180 | + |
| 181 | +### Optional (for research tools) |
| 182 | + |
| 183 | +```bash |
| 184 | +pip install -r Research/requirements_viz.txt |
| 185 | +``` |
| 186 | + |
| 187 | +### System Services (Linux) |
| 188 | + |
| 189 | +- `trading.service`: Main bot service configuration |
| 190 | +- `symbols_update.service`: Automatic market data updates |
| 191 | + |
| 192 | +--- |
| 193 | + |
| 194 | +**⚠️ Risk Warning**: This is a high-frequency trading bot designed for experienced traders. Always test thoroughly with small amounts before deploying significant capital. Past performance does not guarantee future results. |
0 commit comments