In this example we will take an existing strategy, Strategy004 and we will use Hyperopt Parameters to find more optimal settings with recent trading data. We will run our experiment in the cloud.
There is a screencast available to right here. Enjoy!
In order to install and setup Freqtrade, I recommend following the instructions in the Optimize trading strategy using Freqtrade repo first.
Assuming you have already installed freqtrade as shown above and are running using Docker, you can do the following to run this demo:
- Clone this repo
- Start Bot in Dry Run as a quick check using
docker-compose up
and check the log output to confirm it is correctly usingStrategy004
and using the expected parameters. - Stop the Bot using
docker-compose down
- Run the hyperopt locally with just 2 epochs as a quick check that the Hyperopt is working
- Start up a new instance, that has at least 4 CPU cores using the cloud provbider of your choice such as AWS, Digital Ocean or other
- Install Docker and other dependencies on your new cloud instance
- Run the bot hyperopt on the machine using 4000 epochs.
- Download docker compose
curl https://raw.githubusercontent.com/freqtrade/freqtrade/stable/docker-compose.yml -o docker-compose.yml
and pull down the imagedc pull
- Run scaffold
dcr freqtrade create-userdir --userdir user_data
- Run config generator
dcr freqtrade new-config --config user_data/config.json
- Update config pairs with the pairs you want to use
- Copy Strategy004 (or the strategy you want to use)
- Update
docker-compose.yml
strategy using--strategy Strategy004
- Run dry run check
docker-compose up
- Update the strategy with a few Hyperopt params to begin with so that you can test you have everything wired up.
- Download Data for Hyperopt, for example 5m candles:
dcr freqtrade download-data --exchange binance -t 5m
- Run Hyperopt tool to check with just 2 epochs
dcr freqtrade hyperopt --hyperopt-loss SharpeHyperOptLoss --strategy Strategy004 -i 5m -e 2
- Deploy to cloud
git clone https://github.com/devbootstrap/freqtrade-hyperopt-running-in-cloud-example.git
(assumes cloud instance already setup with git, docker and so on installed). cd freqtrade-hyperopt-running-in-cloud-example/ft_userdata - Pull image onto the cloud instance
dc pull
(assumes you are in the correct directory and have aliased the commanddc
todocker-compose
) - Run hyperopt 3000 (or more if you like) epochs
dcr freqtrade hyperopt --hyperopt-loss SharpeHyperOptLoss --strategy Strategy004 -i 5m -e 3000
- End hyperopt and update strategy with results by updating the default values in the strategy hyperopt params.
- Run dry run again and maybe go live.