Deploying freqtrade
, an open-source crypto trading bot, on a cloud server or a Docker environment allows for seamless algorithmic trading execution. In this guide, we'll outline detailed steps for deploying freqtrade
in both environments.
Deploying Freqtrade on a Cloud Server
Deploying freqtrade
on a cloud server is an efficient choice for reducing local resource usage and ensuring continuous trading. Here's how you can achieve this:
1. Setting Up the Cloud Server
First, select a cloud provider such as AWS, Google Cloud, or DigitalOcean. For demonstration purposes, we will use DigitalOcean:
- Create a new project on DigitalOcean.
- Deploy a Droplet with your preferred operating system (preferably Ubuntu for simplicity).
- SSH into your newly created server:
ssh root@your_server_ip
2. Installing Dependencies
Start by updating your package list and installing the required dependencies:
sudo apt update && sudo apt upgrade -y
sudo apt install python3-pip python3-dev libssl-dev libffi-dev git -y
3. Cloning and Configuring Freqtrade
Next, clone the freqtrade
repository and enter the directory:
git clone https://github.com/freqtrade/freqtrade.git
cd freqtrade
Create a virtual environment to manage dependencies and activate it:
python3 -m venv .env
source .env/bin/activate
Install freqtrade
dependencies:
pip install -r requirements.txt
Generate the default configuration:
freqtrade new-config
4. Running Freqtrade
After setting up the configuration, start freqtrade
:
freqtrade trade
freqtrade
is now deployed on your cloud server and is ready to execute trading strategies defined in the configuration.
Deploying Freqtrade with Docker
Deploying on Docker is another efficient and simpler method given Docker’s containerization advantage:
1. Installing Docker
Ensure Docker is installed and running on your system. You can follow these commands for Ubuntu:
sudo apt update
sudo apt install docker.io -y
sudo systemctl start docker
sudo systemctl enable docker
2. Pulling the Freqtrade Docker Image
Get the latest freqtrade
image from Docker Hub:
docker pull freqtradeorg/freqtrade:stable
3. Initializing Freqtrade with Docker
Create a directory for your freqtrade
configuration files:
mkdir freqtrade
cd freqtrade
Initialize your container, mapping it to the local config directory:
docker run -it --rm -v $(pwd)/user_data:/freqtrade/user_data freqtradeorg/freqtrade:stable create-userdir --userdir /freqtrade/user_data
4. Configuring the Trading Bot
Edit the generated config.json
within the user_data/config/mystrategy/config.json
file, ensuring it reflects your chosen strategy and exchange details.
5. Running the Trading Bot with Docker
Run your configured bot:
docker-compose up -d
Ensure Docker Compose is installed; if not, it can be added with the command:
sudo apt install docker-compose
With these steps completed, your freqtrade
bot is actively running on a Docker container, enabling easy updates and scalability.
Conclusion
By deploying freqtrade
on a cloud server or using Docker, you gain an edge with persistent market presence and operational efficiency. Ensure consistent monitoring and adjustments to your chosen strategies to keep up with market dynamics.