Automate your Freqtrade hyperopt runs across multiple strategies, timeframes, and configurations with comprehensive result tracking and analysis.
- π Batch Processing: Run hyperopt on multiple strategies automatically
- π Multiple Configurations: Support for different timeframes, hyperopt losses, and epochs
- π¨ Colored Output: Preserves Freqtrade's colored console output for better readability
- π Organized Results: Structured output with timestamped folders and comprehensive summaries
- π‘οΈ Error Recovery: Continues execution even if individual runs fail
- π Path Resolution: Intelligent freqtrade binary detection with multiple fallback paths
- π Real-time Monitoring: Live progress streaming with detailed logging
- π§ Flexible Configuration: Easy CSV-based configuration management
freqtrade-hyperopt-automation/
βββ π configs/ # Configuration files
β βββ hyperopt_configs.csv # Main hyperopt configuration
βββ π output/ # Generated results
β βββ YYMMDD_HHMM/ # Timestamped session folders
β βββ hyperopt_summary.csv # Comprehensive results summary
β βββ [timeframe]/ # Results organized by timeframe
βββ π logs/ # Execution logs
β βββ hyperopt/ # Hyperopt execution logs
β βββ errors/ # Error logs
β βββ debug/ # Debug information
βββ π scripts/ # Utility scripts
β βββ setup_environment.sh # Environment setup
β βββ backup_results.sh # Results backup
β βββ analyze_performance.py # Performance analysis
βββ π examples/ # Example configurations
βββ π run_hyperopt.py # Main execution script
βββ π executor.py # Core hyperopt executor
βββ π README.md # This file
- Python 3.8+ with pip
- Freqtrade 2025.6+ installed and configured
- Git for cloning the repository
# Clone the repository
git clone https://github.com/Facepipe/Freqtrade-Hyperopt-Automation.git
cd Freqtrade-Hyperopt-Automation
# Run the setup script
./scripts/setup_environment.sh
# Make scripts executable (if needed)
chmod +x scripts/*.sh *.pyEdit executor.py and update the FREQTRADE_PATHS list with your freqtrade installation path:
FREQTRADE_PATHS = [
"/home/yourusername/freqtrade/.venv/bin/freqtrade", # Update this path
"~/.local/bin/freqtrade", # User installation
"/usr/local/bin/freqtrade", # System installation
shutil.which("freqtrade") # PATH lookup
]Edit configs/hyperopt_configs.csv:
strategy,timeframe,hyperopt_loss,epochs,config_file,timerange
SampleStrategy,5m,SharpeHyperOptLoss,100,user_data/config.json,20240101-20240201
MyStrategy,1h,OnlyProfitHyperOptLoss,200,user_data/config_alt.json,20240101-20240301Configuration Parameters:
- strategy: Strategy class name
- timeframe: Candlestick timeframe (1m, 5m, 1h, etc.)
- hyperopt_loss: Loss function (SharpeHyperOptLoss, OnlyProfitHyperOptLoss, etc.)
- epochs: Number of hyperopt iterations
- config_file: Path to freqtrade configuration file
- timerange: Date range for backtesting (YYYYMMDD-YYYYMMDD)
# Run all configured hyperopt sessions
python3 run_hyperopt.py
# Or with explicit path
/usr/bin/python3 run_hyperopt.pyEach hyperopt session creates a timestamped folder with organized results:
output/
βββ 250105_1430/ # Session timestamp (YYMMDD_HHMM)
βββ hyperopt_summary.csv # Consolidated results
βββ 5m/ # Timeframe-specific results
β βββ SharpeHyperOptLoss/ # Loss function results
β βββ SampleStrategy/ # Strategy-specific outputs
β βββ config_run1.json
β βββ results_best_run1.txt
β βββ results_profitable_run1.txt
βββ 1h/
βββ OnlyProfitHyperOptLoss/
βββ MyStrategy/
βββ config_run2.json
βββ results_best_run2.txt
βββ results_profitable_run2.txt
The hyperopt_summary.csv contains key metrics for all runs:
| Column | Description |
|---|---|
session_id |
Unique session identifier |
run_number |
Sequential run number |
strategy |
Strategy name |
timeframe |
Used timeframe |
hyperopt_loss |
Loss function |
epochs |
Number of epochs |
total_profit |
Total profit percentage |
win_ratio |
Win ratio percentage |
avg_profit |
Average profit per trade |
total_trades |
Total number of trades |
start_time |
Run start timestamp |
end_time |
Run completion timestamp |
duration |
Execution duration |
status |
Success/failure status |
The system supports all built-in Freqtrade loss functions:
SharpeHyperOptLoss- Optimizes Sharpe ratioOnlyProfitHyperOptLoss- Focuses only on profitSortinoHyperOptLoss- Optimizes Sortino ratioCalmarHyperOptLoss- Optimizes Calmar ratioMaxDrawDownHyperOptLoss- Minimizes maximum drawdown
# Create backup of results
./scripts/backup_results.sh
# Analyze performance
python3 scripts/analyze_performance.py
# Quick performance overview
grep "Best result" output/*/logs/*.log1. Freqtrade Not Found
# Check if freqtrade is in PATH
which freqtrade
# Verify version
freqtrade --version
# Update path in executor.py2. Configuration File Not Found
# Check file exists
ls -la configs/hyperopt_configs.csv
# Verify config file paths in CSV
cat configs/hyperopt_configs.csv3. Permission Errors
# Make scripts executable
chmod +x scripts/*.sh *.py
# Check directory permissions
ls -la- Start Small: Begin with fewer epochs (50-100) to test configurations
- Progressive Refinement: Use successful parameters as starting points
- Multiple Runs: Run the same configuration multiple times with different random states
- Resource Management: Monitor CPU and memory usage during long runs
- Data Quality: Ensure you have sufficient historical data
- Timerange Selection: Use meaningful date ranges for backtesting
- Strategy Validation: Validate strategies in dry-run before live trading
- Regular Backups: Backup successful configurations and results
- β¨ New: Organized output folder structure by session/timeframe/loss/strategy
- β¨ New: Incremental summary CSV building
- β¨ New: Single session timestamps for better organization
- π Fixed: Maintained all previous functionality and path handling
- π Fixed: ExecutionResult reference error
- β¨ New: Single comprehensive summary CSV
- β¨ New: Per-run text files for each strategy
- β Maintained: Colored console output, timerange formatting, path resolution
- π Fixed: Base directory reference error
- β¨ New: Single summary CSV after all strategies complete
- β¨ Improved: Directory structure organization
- Path resolution improvements
- Error handling enhancements
- Console output formatting
- Real-time progress streaming
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
# Clone and setup development environment
git clone https://github.com/Facepipe/Freqtrade-Hyperopt-Automation.git
cd Freqtrade-Hyperopt-Automation
# Create feature branch
git checkout -b feature/your-feature-name
# Make changes and test
python3 run_hyperopt.py
# Commit and push
git commit -m "Add your feature"
git push origin feature/your-feature-nameThis project is licensed under the MIT License - see the LICENSE file for details.
- Freqtrade - The excellent cryptocurrency trading bot
- The Freqtrade community for strategies and guidance
- Contributors and users of this automation system
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Freqtrade Documentation: Official Docs
π― Made with β€οΈ for the Freqtrade community