[Tutorial] Your first trading bot with Freqtrade

Introduction

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!

Prerequisites

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.


With Botcrypto, save time and optimize your trading by creating your own cryptocurrency trading bots. No technical knowledge is required thanks to our 100% visual editor. Try for free!

Nothing on the blog constitutes investment, legal, tax or other advice, nor should it inspire any investment or decision. Past performance is no guarantee of future performance.

Post Author: Quentin

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

    Chris_P

    (31 January 2021 - 17 h 03 min)

    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 🙂

    Théo

    (1 February 2021 - 17 h 13 min)

    Hi Chris,

    It was not correctly displayed, we fixed it! Thank you for your feedback.

    Have a nice day!

    Théo

Leave a Reply

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.