In this episode, I take you through getting FreqTrade installed and configured, running as a Docker container, starting with a completely plain Ubuntu Server OS. What could be easier! Check out the video to follow along, and below is the example code referenced in the video. This takes all the guesswork out of getting FreqTrade up and running, so you can start configuring and testing your trading strategies right away!
Also, if you’re looking for a great machine to run your fleet of FreqTrade bots on, I highly recommend this small form-factor Intel NUC – this is an amazing price on a rock-solid piece of hardware, in a compact, silent, power-efficient format! Please note this is an affiliate link and I may receive a commission from your purchase. Clicking this link and completing your regular Amazon purchases is an easy no-cost way to support the channel!
Install Docker
https://get.docker.com is the source for your one-line (okay technically two; you download it, then you execute it) Docker installation script
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
Install Docker Compose
Next, we need Docker Compose. This is also very simple:
sudo apt update && sudo apt install docker-compose -y
Add your user to the “docker” group
To save you from constantly having to prefix your docker commands with sudo
, and more importantly to ensure your containers have the correct permissions to local configuration files you configure, let’s add your running user (whatever user you’re logged in to your new Ubuntu server right now) to the docker
security group. In order for this to take effect, you have to log out and back in to the server afterward.
sudo usermod -a -G docker [username]
Don’t forget to log out and back in at this point, so that change takes effect.
Install FreqTrade
Now that we’ve got Docker installed and running, it’s time to get FreqTrade installed, as a Docker container of course! You’re going to make a directory called freqtrade
, change directory (cd
) in to it, then pull the latest docker-compose.yml
from the FreqTrade Git repository. Last, you will issue the docker-compose pull
command, which tells Docker to pull down the container images specified in the docker-compose.yml
file. Let’s go!
mkdir freqtrade
cd freqtrade
curl https://raw.githubusercontent.com/freqtrade/freqtrade/stable/docker-compose.yml -o docker-compose.yml
docker-compose pull
Configure FreqTrade
Now that we have all the needed pieces of FreqTrade downloaded, we need to do some initial configuration. The developers of FreqTrade built in a way to set up the file and folder structure, and build out a baseline config.json, by issuing commands to the FreqTrade Docker image, and invoke it to ask you some basic questions. Neat! The first one here creates the file and folder structure:
docker-compose run --rm freqtrade create-userdir --userdir user_data
Next, we’ll run a similar command, which will start up an interactive series of questions, to get your FreqTrade config off to a good start:
docker-compose run --rm freqtrade new-config --config user_data/config.json
This will ask you some questions, and generally the defaults are all fine, except a couple things for the API, so you can use the WebUI in a browser to control and monitor FreqTrade! Enable API: YES
API Listen: 0.0.0.0
Next, we need to pull out some invalid trade pairs from the basic config.json
(if you are using Binance US specifically, and maybe others too), otherwise FreqTrade will not start up properly.
nano user_data/config.json
Find the Whitelist section, and remove:
ALGO/BTC,
ATOM/BTC,
BAT/BTC,
BRD/BTC,
EOS/BTC,
IOTA/BTC,
NEO/BTC,
NXS/BTC,
XMR/BTC
Save and exit (ctrl+o and ctrl+x)
Lastly, we need to edit the docker-compose.yml and enable our commented-out network ports, so we can see the WebUI when we start the container
nano docker-compose.yml
find the ports:
section and delete the leading # comment symbol
delete the # comment symbol from the next line, where 8080 ports are
ensure line spacing is correct! “ports:” should be the same level of indentation as the other directives above it, such as “volumes:”
Remove the "127.0.0.1:"
from the port mapping. Your final ports:
section should look like this:
ports:
- "8080:8080"
Start FreqTrade
Time to start it up! The below command will launch the FreqTrade instance. You can also monitor its’ realtime logs with the command docker logs -f freqtrade
(with “freqtrade” being the name of the container, and -f
means “follow”; similar to “tail” if you’re familiar with other CLI logging)
docker-compose up -d
That should do it! Now you can point your web browser at http://IPofYourServer:8080 and you should be presented with the FreqTrade WebUI. Click the login button in the top right, and enter the username and password you provided during the config questions earlier. Then you can click the Trade or Dashboard buttons in the upper left, to see what’s going on with your shiny new trading bot!
Bonus: Change to a dynamically generated Pairlist
As a bonus configuration point, I talked about this in the closing part of the video, let’s change your list of trading pairs to something dynamic, rather than just a static-defined set of whitelisted pairs. Go edit your config.json
once more, and find the "pairlists": [
section. You can change from the default “StaticPairList” to “VolumePairList” as described here, with a couple methods for how it will evaluate and decide which pairs are good to use. You’ll see I have commented out the StaticPairlists
with the leading //
so you know where it should go, and can switch back if you want.
"pairlists": [
{
// "method": "StaticPairList"
"method": "VolumePairList",
"number_assets": 70,
"sort_key": "quoteVolume",
"refresh_period": 1800
},
{
"method": "AgeFilter",
"min_days_listed": 10
},
{
"method": "RangeStabilityFilter",
"lookback_days": 5,
"min_rate_of_change": 0.02,
"refresh_period": 1440
}
],
how to run multibot using this method