跳到主要内容

How to Update Freqtrade

To update your freqtrade installation, please use one of the below methods, corresponding to your installation method.

Tracking Changes

Breaking changes / changed behavior will be documented in the changelog that is posted alongside every release.

For the develop branch, please follow PR's to avoid being surprised by changes.

Docker Installation

Legacy Master Image

We're switching from master to stable for the release Images - please adjust your docker-file and replace freqtradeorg/freqtrade:master with freqtradeorg/freqtrade:stable

Update Docker Installation

# Stop the current container
docker compose down

# Pull the latest image
docker compose pull

# Start with the new image
docker compose up -d

Update to Specific Version

# Edit docker-compose.yml to specify version
# Change: freqtradeorg/freqtrade:stable
# To: freqtradeorg/freqtrade:2024.1

# Pull and restart
docker compose pull
docker compose up -d

Verify Update

# Check running version
docker compose exec freqtrade freqtrade --version

# Check logs for any issues
docker compose logs -f

Installation via Setup Script

# Run update script
./setup.sh --update
Virtual Environment

Make sure to run this command with your virtual environment disabled!

Manual Update with Setup Script

# Stop the bot first
pkill -f freqtrade

# Run update
./setup.sh --update

# Restart the bot
freqtrade trade --config config.json

Native Installation

Please ensure that you're also updating dependencies - otherwise things might break without you noticing.

Update Steps

# Stop the bot
pkill -f freqtrade

# Update source code
git pull

# Update Python dependencies
pip install -U -r requirements.txt

# Install freqtrade
pip install -e .

# Ensure FreqUI is at the latest version
freqtrade install-ui

# Restart the bot
freqtrade trade --config config.json

Update to Specific Version

# Check available versions
git tag -l

# Switch to specific version
git checkout 2024.1

# Update dependencies
pip install -U -r requirements.txt
pip install -e .

# Update FreqUI
freqtrade install-ui

Update from Develop Branch

# Switch to develop branch
git checkout develop

# Pull latest changes
git pull

# Update dependencies
pip install -U -r requirements.txt
pip install -e .

# Update FreqUI
freqtrade install-ui

Conda Installation

# Activate conda environment
conda activate freqtrade

# Update freqtrade
git pull
pip install -U -r requirements.txt
pip install -e .

# Update FreqUI
freqtrade install-ui

PyPI Installation

# Update freqtrade from PyPI
pip install -U freqtrade

# Update FreqUI
freqtrade install-ui

Pre-Update Checklist

Before updating, it's recommended to:

1. Backup Important Data

# Backup configuration
cp config.json config.json.backup

# Backup database
cp user_data/tradesv3.sqlite user_data/tradesv3.sqlite.backup

# Backup custom strategies
cp -r user_data/strategies user_data/strategies.backup

# Backup logs (optional)
cp -r user_data/logs user_data/logs.backup

2. Check Current Version

# Check current version
freqtrade --version

# Check git status (for git installations)
git status
git log --oneline -5

3. Review Changelog

  • Check the GitHub Releases page
  • Review breaking changes and new features
  • Check if your strategies need updates

Post-Update Steps

1. Verify Installation

# Check version
freqtrade --version

# Test configuration
freqtrade show-config

# Test strategy loading
freqtrade list-strategies

2. Test Bot Functionality

# Test with dry run
freqtrade trade --config config.json --dry-run

# Check logs for errors
tail -f user_data/logs/freqtrade.log

3. Update Strategies (if needed)

Some updates may require strategy modifications. Check:

  • Strategy interface version compatibility
  • New or changed callback methods
  • Updated indicator libraries
  • Configuration parameter changes

Troubleshooting Updates

Common Update Problems

Dependency Issues:

# Clear pip cache
pip cache purge

# Reinstall dependencies
pip install --force-reinstall -r requirements.txt

TA-Lib Issues:

# On Ubuntu/Debian
sudo apt-get install libta-lib-dev

# On macOS
brew install ta-lib

# Reinstall TA-Lib Python wrapper
pip uninstall TA-Lib
pip install TA-Lib

Permission Issues:

# Fix permissions
sudo chown -R $USER:$USER user_data/

# Or use virtual environment
python -m venv .venv
source .venv/bin/activate

Git Issues:

# Reset local changes
git stash
git pull
git stash pop

# Or hard reset (loses local changes)
git reset --hard origin/stable

Database Migration Issues

Sometimes database schema changes require migration:

# Backup database first
cp user_data/tradesv3.sqlite user_data/tradesv3.sqlite.backup

# Let freqtrade handle migration automatically
freqtrade trade --config config.json

Strategy Compatibility Issues

If strategies fail after update:

  1. Check interface version:

    INTERFACE_VERSION = 3  # Update if needed
  2. Update deprecated methods:

    • Check changelog for method changes
    • Update callback signatures
    • Fix import statements
  3. Test strategy:

    freqtrade backtesting --strategy YourStrategy --timerange 20231201-20231210

Version Management

Stable vs Development

Stable Branch:

  • Recommended for production use
  • Monthly releases
  • Well-tested features
  • Fewer breaking changes

Development Branch:

  • Latest features
  • Daily updates
  • May have bugs
  • More breaking changes

Choosing Update Frequency

Conservative Approach:

  • Update monthly with stable releases
  • Test thoroughly before production
  • Keep backups of working versions

Aggressive Approach:

  • Update weekly or bi-weekly
  • Use development branch
  • Quick to adopt new features
  • Higher risk of issues

Automated Updates

Docker with Watchtower

# docker-compose.yml
version: '3'
services:
freqtrade:
image: freqtradeorg/freqtrade:stable
# ... other config

watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 86400 # Check daily

Systemd Service with Auto-Update

# Create update script
cat > /usr/local/bin/freqtrade-update.sh << 'EOF'
#!/bin/bash
cd /path/to/freqtrade
git pull
pip install -U -r requirements.txt
pip install -e .
systemctl restart freqtrade
EOF

chmod +x /usr/local/bin/freqtrade-update.sh

# Create systemd timer
sudo systemctl edit --force --full freqtrade-update.timer

Best Practices

Update Strategy

  1. Test in staging - Always test updates in a non-production environment
  2. Gradual rollout - Update one bot at a time if running multiple
  3. Monitor closely - Watch logs and performance after updates
  4. Have rollback plan - Keep previous version available for quick rollback
  5. Document changes - Keep track of what was updated and when

Maintenance Schedule

Weekly:

  • Check for security updates
  • Review bot performance
  • Monitor for new releases

Monthly:

  • Update to latest stable version
  • Review and update strategies
  • Clean up old log files
  • Backup important data

Quarterly:

  • Review overall setup
  • Update system dependencies
  • Security audit
  • Performance optimization

Getting Help

If you encounter issues during updates:

Next Steps

After successful update:

  1. Configuration - Review configuration changes
  2. Strategy Development - Update strategies if needed
  3. Bot Usage - Resume normal operations
  4. Monitoring - Monitor bot performance

Resources