[Tutorial] Your first trading bot with Freqtrade


Freqtrade is a free and open source crypto trading software. With Freqtrade, you can create fully customizable trading bots, make backtests, etc… The software is developed in python and is compatible with Windows, MacOS and Linux.

Tutorial’s goal : install Freqtrade and perform a backtest with a basic strategy

This tutorial is intended both for people wishing to create their first crypto trading bot and for curious people wishing to discover how Freqtrade works. Freqtrade does not offer a graphical user interface, and it is rather reserved for users with technical knowledge. If you want to easily and quickly create crypto trading bots, take a look at our platform Botcrypto. The registration is free!


This tutorial has been realized on a Ubuntu 20.04 server.

We will need python3 and git.

  • To install the various prerequisites, run the following command:

sudo apt install git && sudo apt install python3 && sudo apt install python3-pip && sudo apt install python3-venv

Freqtrade’s installation

  • First, we will clone the git repository by executing the command below:

git clone https://github.com/freqtrade/freqtrade.git

  • Once the download is complete, we will go to the freqtrade folder:

cd freqtrade

  • Then we will execute as administrator the installation script setup.sh :

sudo ./setup.sh --install

L'installation du logiciel
Installation of the software

For both downloading development dependencies and resetting the git branch, press the <Enter> key to choose the default value (which is ‘no’ in both cases).

Freqtrade’s configuration

  • In order to use Freqtrade, you need to activate his virtual environment :

source .env/bin/activate;

You can now use the Freqtrade commands. First we will choose different parameters for your first robot.

  • Execute the command freqtrade new-config -c config.json
Freqtrade's configuration
The configuration

For each question, press the <Enter> key to choose the default value.

Freqtrade’s usage

  • To create a strategy called test, simply execute the following command:

freqtrade new-strategy --strategy test

A strategy with default values is then created. We will see in a future tutorial how to customize this strategy.

Now we will use this strategy in a backtest, a test in the past. We will need the old market data.

  • Execute freqtrade download-data to download old market data.

Downloading market data can take a few minutes.

  • Once the download is complete, run :

freqtrade backtesting --strategy test

Once the backtest is complete, you will see a summary of its results.

My backtest results with Freqtrade
My backtest results

We can see from the results of my bot that it was not very efficient:

-36.32% in a month in which the market lost only 10.2%. My bot made me lose 3.6x more money than if I had just invested…

We notice that the robot has 20 winning trades against 7 losers which questions us on the reason of the final result. We notice via the Worst day value that one day the robot lost 28.54%, which is considerable. If we had personalized our strategy by better managing our risk, this would not have happened. And that’s the subject of our next article 😉 [Tutorial] Create your own trading bot strategy with Freqtrade. In the meantime, you can consult our guide about trading bots to learn more about trading bots.

4 thoughts on “[Tutorial] Your first trading bot with Freqtrade”

  1. There’s a typo in this line: freqtrade new-strategy -–strategy test

    It should hould be: freqtrade new-strategy –strategy test

    Thaks for the tutorial 🙂

  2. When I do: freqtrade download-data. Nothing is happening. It’s not downloading anything because I think no trading pairs have been defined anywhere in this tutorial. For sure some steps are missing here, because it’s not downloading and therefore not back testing either. Can you please clarify where we define the trading pairs for this example?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.