from freqtrade/develop
This commit is contained in:
379
docs/installation.md
Normal file → Executable file
379
docs/installation.md
Normal file → Executable file
@@ -1,111 +1,200 @@
|
||||
# Install the bot
|
||||
# Installation
|
||||
|
||||
This page explains how to prepare your environment for running the bot.
|
||||
To understand how to set up the bot please read the Bot
|
||||
[Bot configuration](https://github.com/gcarq/freqtrade/blob/develop/docs/configuration.md)
|
||||
page.
|
||||
|
||||
To understand how to set up the bot please read the [Bot Configuration](https://github.com/freqtrade/freqtrade/blob/develop/docs/configuration.md) page.
|
||||
|
||||
## Table of Contents
|
||||
- [Docker Automatic Installation](#docker)
|
||||
- [Linux or Mac manual Installation](#linux--mac)
|
||||
- [Linux - Ubuntu 16.04](#21-linux---ubuntu-1604)
|
||||
- [Linux - Other distro](#22-linux---other-distro)
|
||||
- [MacOS installation](#23-macos-installation)
|
||||
- [Advanced Linux ](#advanced-linux)
|
||||
- [Windows manual Installation](#windows)
|
||||
|
||||
# Docker
|
||||
* [Table of Contents](#table-of-contents)
|
||||
* [Easy Installation - Linux Script](#easy-installation---linux-script)
|
||||
* [Manual installation](#manual-installation)
|
||||
* [Automatic Installation - Docker](#automatic-installation---docker)
|
||||
* [Custom Linux MacOS Installation](#custom-installation)
|
||||
- [Requirements](#requirements)
|
||||
- [Linux - Ubuntu 16.04](#linux---ubuntu-1604)
|
||||
- [MacOS](#macos)
|
||||
- [Setup Config and virtual env](#setup-config-and-virtual-env)
|
||||
* [Windows](#windows)
|
||||
|
||||
## Easy installation
|
||||
Start by downloading Docker for your platform:
|
||||
- [Mac](https://www.docker.com/products/docker#/mac)
|
||||
- [Windows](https://www.docker.com/products/docker#/windows)
|
||||
- [Linux](https://www.docker.com/products/docker#/linux)
|
||||
<!-- /TOC -->
|
||||
|
||||
Once you have Docker installed, simply create the config file
|
||||
(e.g. `config.json`) and then create a Docker image for `freqtrade`
|
||||
using the Dockerfile in this repo.
|
||||
------
|
||||
|
||||
## Easy Installation - Linux Script
|
||||
|
||||
If you are on Debian, Ubuntu or MacOS a freqtrade provides a script to Install, Update, Configure, and Reset your bot.
|
||||
|
||||
### 1. Prepare the bot
|
||||
1. Clone the git
|
||||
```bash
|
||||
git clone https://github.com/gcarq/freqtrade.git
|
||||
$ ./setup.sh
|
||||
usage:
|
||||
-i,--install Install freqtrade from scratch
|
||||
-u,--update Command git pull to update.
|
||||
-r,--reset Hard reset your develop/master branch.
|
||||
-c,--config Easy config generator (Will override your existing file).
|
||||
```
|
||||
2. (Optional) Checkout the develop branch
|
||||
|
||||
### --install
|
||||
|
||||
This script will install everything you need to run the bot:
|
||||
|
||||
* Mandatory software as: `Python3`, `ta-lib`, `wget`
|
||||
* Setup your virtualenv
|
||||
* Configure your `config.json` file
|
||||
|
||||
This script is a combination of `install script` `--reset`, `--config`
|
||||
|
||||
### --update
|
||||
|
||||
Update parameter will pull the last version of your current branch and update your virtualenv.
|
||||
|
||||
### --reset
|
||||
|
||||
Reset parameter will hard reset your branch (only if you are on `master` or `develop`) and recreate your virtualenv.
|
||||
|
||||
### --config
|
||||
|
||||
Config parameter is a `config.json` configurator. This script will ask you questions to setup your bot and create your `config.json`.
|
||||
|
||||
|
||||
## Manual installation - Linux/MacOS
|
||||
The following steps are made for Linux/MacOS environment
|
||||
|
||||
**1. Clone the repo**
|
||||
```bash
|
||||
git clone git@github.com:freqtrade/freqtrade.git
|
||||
git checkout develop
|
||||
cd freqtrade
|
||||
```
|
||||
**2. Create the config file**
|
||||
Switch `"dry_run": true,`
|
||||
```bash
|
||||
cp config.json.example config.json
|
||||
vi config.json
|
||||
```
|
||||
**3. Build your docker image and run it**
|
||||
```bash
|
||||
docker build -t freqtrade .
|
||||
docker run --rm -v /etc/localtime:/etc/localtime:ro -v `pwd`/config.json:/freqtrade/config.json -it freqtrade
|
||||
```
|
||||
|
||||
------
|
||||
|
||||
## Automatic Installation - Docker
|
||||
|
||||
Start by downloading Docker for your platform:
|
||||
|
||||
* [Mac](https://www.docker.com/products/docker#/mac)
|
||||
* [Windows](https://www.docker.com/products/docker#/windows)
|
||||
* [Linux](https://www.docker.com/products/docker#/linux)
|
||||
|
||||
Once you have Docker installed, simply create the config file (e.g. `config.json`) and then create a Docker image for `freqtrade` using the Dockerfile in this repo.
|
||||
|
||||
### 1. Prepare the Bot
|
||||
|
||||
#### 1.1. Clone the git repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/freqtrade/freqtrade.git
|
||||
```
|
||||
|
||||
#### 1.2. (Optional) Checkout the develop branch
|
||||
|
||||
```bash
|
||||
git checkout develop
|
||||
```
|
||||
3. Go into the new directory
|
||||
|
||||
#### 1.3. Go into the new directory
|
||||
|
||||
```bash
|
||||
cd freqtrade
|
||||
```
|
||||
4. Copy `config.sample` to `config.json`
|
||||
```bash
|
||||
cp config.json.example config.json
|
||||
```
|
||||
To edit the config please refer to the [Bot Configuration](https://github.com/gcarq/freqtrade/blob/develop/docs/configuration.md) page
|
||||
5. Create your DB file (Optional, the bot will create it if it is missing)
|
||||
```bash
|
||||
# For Production
|
||||
touch tradesv3.sqlite
|
||||
|
||||
# For Dry-run
|
||||
#### 1.4. Copy `config.json.example` to `config.json`
|
||||
|
||||
```bash
|
||||
cp -n config.json.example config.json
|
||||
```
|
||||
|
||||
> To edit the config please refer to the [Bot Configuration](https://github.com/freqtrade/freqtrade/blob/develop/docs/configuration.md) page.
|
||||
|
||||
#### 1.5. Create your database file *(optional - the bot will create it if it is missing)*
|
||||
|
||||
Production
|
||||
|
||||
```bash
|
||||
touch tradesv3.sqlite
|
||||
````
|
||||
|
||||
Dry-Run
|
||||
|
||||
```bash
|
||||
touch tradesv3.dryrun.sqlite
|
||||
```
|
||||
|
||||
### 2. Build the docker image
|
||||
### 2. Build the Docker image
|
||||
|
||||
```bash
|
||||
cd freqtrade
|
||||
docker build -t freqtrade .
|
||||
```
|
||||
|
||||
For security reasons, your configuration file will not be included in the
|
||||
image, you will need to bind mount it. It is also advised to bind mount
|
||||
a sqlite database file (see the "5. Run a restartable docker image"
|
||||
section) to keep it between updates.
|
||||
For security reasons, your configuration file will not be included in the image, you will need to bind mount it. It is also advised to bind mount an SQLite database file (see the "5. Run a restartable docker image" section) to keep it between updates.
|
||||
|
||||
### 3. Verify the docker image
|
||||
After build process you can verify that the image was created with:
|
||||
```
|
||||
### 3. Verify the Docker image
|
||||
|
||||
After the build process you can verify that the image was created with:
|
||||
|
||||
```bash
|
||||
docker images
|
||||
```
|
||||
|
||||
### 4. Run the docker image
|
||||
You can run a one-off container that is immediately deleted upon exiting with
|
||||
the following command (config.json must be in the current working directory):
|
||||
### 4. Run the Docker image
|
||||
|
||||
```
|
||||
docker run --rm -v `pwd`/config.json:/freqtrade/config.json -it freqtrade
|
||||
You can run a one-off container that is immediately deleted upon exiting with the following command (`config.json` must be in the current working directory):
|
||||
|
||||
```bash
|
||||
docker run --rm -v /etc/localtime:/etc/localtime:ro -v `pwd`/config.json:/freqtrade/config.json -it freqtrade
|
||||
```
|
||||
|
||||
In this example, the database will be created inside the docker instance
|
||||
and will be lost when you will refresh your image.
|
||||
There is known issue in OSX Docker versions after 17.09.1, whereby /etc/localtime cannot be shared causing Docker to not start. A work-around for this is to start with the following cmd.
|
||||
|
||||
```bash
|
||||
docker run --rm -e TZ=`ls -la /etc/localtime | cut -d/ -f8-9` -v `pwd`/config.json:/freqtrade/config.json -it freqtrade
|
||||
```
|
||||
|
||||
More information on this docker issue and work-around can be read [here](https://github.com/docker/for-mac/issues/2396)
|
||||
|
||||
In this example, the database will be created inside the docker instance and will be lost when you will refresh your image.
|
||||
|
||||
### 5. Run a restartable docker image
|
||||
To run a restartable instance in the background (feel free to place your
|
||||
configuration and database files wherever it feels comfortable on your
|
||||
filesystem).
|
||||
|
||||
**5.1. Move your config file and database**
|
||||
To run a restartable instance in the background (feel free to place your configuration and database files wherever it feels comfortable on your filesystem).
|
||||
|
||||
#### 5.1. Move your config file and database
|
||||
|
||||
```bash
|
||||
mkdir ~/.freqtrade
|
||||
mv config.json ~/.freqtrade
|
||||
mv tradesv3.sqlite ~/.freqtrade
|
||||
```
|
||||
|
||||
**5.2. Run the docker image**
|
||||
#### 5.2. Run the docker image
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name freqtrade \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ~/.freqtrade/config.json:/freqtrade/config.json \
|
||||
-v ~/.freqtrade/tradesv3.sqlite:/freqtrade/tradesv3.sqlite \
|
||||
freqtrade
|
||||
freqtrade --db-url sqlite:///tradesv3.sqlite
|
||||
```
|
||||
If you are using `dry_run=True` it's not necessary to mount
|
||||
`tradesv3.sqlite`, but you can mount `tradesv3.dryrun.sqlite` if you
|
||||
plan to use the dry run mode with the param `--dry-run-db`.
|
||||
|
||||
NOTE: db-url defaults to `sqlite:///tradesv3.sqlite` but it defaults to `sqlite://` if `dry_run=True` is being used.
|
||||
To override this behaviour use a custom db-url value: i.e.: `--db-url sqlite:///tradesv3.dryrun.sqlite`
|
||||
|
||||
### 6. Monitor your Docker instance
|
||||
|
||||
You can then use the following commands to monitor and manage your container:
|
||||
|
||||
```bash
|
||||
@@ -116,35 +205,59 @@ docker stop freqtrade
|
||||
docker start freqtrade
|
||||
```
|
||||
|
||||
You do not need to rebuild the image for configuration changes, it will
|
||||
suffice to edit `config.json` and restart the container.
|
||||
You do not need to rebuild the image for configuration changes, it will suffice to edit `config.json` and restart the container.
|
||||
|
||||
### 7. Backtest with docker
|
||||
|
||||
The following assumes that the above steps (1-4) have been completed successfully.
|
||||
Also, backtest-data should be available at `~/.freqtrade/user_data/`.
|
||||
|
||||
|
||||
# Linux / MacOS
|
||||
## 1. Requirements
|
||||
``` bash
|
||||
docker run -d \
|
||||
--name freqtrade \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
-v ~/.freqtrade/config.json:/freqtrade/config.json \
|
||||
-v ~/.freqtrade/tradesv3.sqlite:/freqtrade/tradesv3.sqlite \
|
||||
-v ~/.freqtrade/user_data/:/freqtrade/user_data/ \
|
||||
freqtrade --strategy AwsomelyProfitableStrategy backtesting
|
||||
```
|
||||
|
||||
Head over to the [Backtesting Documentation](https://github.com/freqtrade/freqtrade/blob/develop/docs/backtesting.md) for more details.
|
||||
|
||||
*Note*: Additional parameters can be appended after the image name (`freqtrade` in the above example).
|
||||
|
||||
------
|
||||
|
||||
## Custom Installation
|
||||
|
||||
We've included/collected install instructions for Ubuntu 16.04, MacOS, and Windows. These are guidelines and your success may vary with other distros.
|
||||
|
||||
### Requirements
|
||||
|
||||
Click each one for install guide:
|
||||
- [Python 3.6.x](http://docs.python-guide.org/en/latest/starting/installation/),
|
||||
note the bot was not tested on Python >= 3.7.x
|
||||
- [pip](https://pip.pypa.io/en/stable/installing/)
|
||||
- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
||||
- [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) (Recommended)
|
||||
- [TA-Lib](https://mrjbq7.github.io/ta-lib/install.html)
|
||||
|
||||
## 2. First install required packages
|
||||
This bot require Python 3.6 and TA-LIB
|
||||
* [Python 3.6.x](http://docs.python-guide.org/en/latest/starting/installation/), note the bot was not tested on Python >= 3.7.x
|
||||
* [pip](https://pip.pypa.io/en/stable/installing/)
|
||||
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
||||
* [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) (Recommended)
|
||||
* [TA-Lib](https://mrjbq7.github.io/ta-lib/install.html)
|
||||
|
||||
### 2.1 Linux - Ubuntu 16.04
|
||||
### Linux - Ubuntu 16.04
|
||||
|
||||
#### 1. Install Python 3.6, Git, and wget
|
||||
|
||||
**2.1.1. Install Python 3.6, Git, and wget**
|
||||
```bash
|
||||
sudo add-apt-repository ppa:jonathonf/python-3.6
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3.6 python3.6-venv python3.6-dev build-essential autoconf libtool pkg-config make wget git
|
||||
```
|
||||
|
||||
**2.1.2. Install TA-LIB**
|
||||
#### 2. Install TA-Lib
|
||||
|
||||
Official webpage: https://mrjbq7.github.io/ta-lib/install.html
|
||||
```
|
||||
|
||||
```bash
|
||||
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
|
||||
tar xvzf ta-lib-0.4.0-src.tar.gz
|
||||
cd ta-lib
|
||||
@@ -155,92 +268,120 @@ cd ..
|
||||
rm -rf ./ta-lib*
|
||||
```
|
||||
|
||||
**2.1.3. [Optional] Install MongoDB**
|
||||
Install MongoDB if you plan to optimize your strategy with Hyperopt.
|
||||
#### 3. Install FreqTrade
|
||||
|
||||
Clone the git repository:
|
||||
|
||||
```bash
|
||||
sudo apt-get install mongodb-org
|
||||
git clone https://github.com/freqtrade/freqtrade.git
|
||||
```
|
||||
Complete tutorial on [Digital Ocean: How to Install MongoDB on Ubuntu 16.04](https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04)
|
||||
|
||||
### 2.2. Linux - Other distro
|
||||
If you are on a different Linux OS you maybe have to adapt things like:
|
||||
#### 4. Configure `freqtrade` as a `systemd` service
|
||||
|
||||
- package manager (for example yum instead of apt-get)
|
||||
- package names
|
||||
From the freqtrade repo... copy `freqtrade.service` to your systemd user directory (usually `~/.config/systemd/user`) and update `WorkingDirectory` and `ExecStart` to match your setup.
|
||||
|
||||
### 2.3. MacOS installation
|
||||
After that you can start the daemon with:
|
||||
|
||||
**2.3.1. Install Python 3.6, git and wget**
|
||||
```bash
|
||||
brew install python3 git wget
|
||||
systemctl --user start freqtrade
|
||||
```
|
||||
|
||||
**2.3.2. [Optional] Install MongoDB**
|
||||
Install MongoDB if you plan to optimize your strategy with Hyperopt.
|
||||
For this to be persistent (run when user is logged out) you'll need to enable `linger` for your freqtrade user.
|
||||
|
||||
```bash
|
||||
curl -O https://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-3.4.10.tgz
|
||||
tar -zxvf mongodb-osx-ssl-x86_64-3.4.10.tgz
|
||||
mkdir -p <path_freqtrade>/env/mongodb
|
||||
cp -R -n mongodb-osx-x86_64-3.4.10/ <path_freqtrade>/env/mongodb
|
||||
export PATH=<path_freqtrade>/env/mongodb/bin:$PATH
|
||||
sudo loginctl enable-linger "$USER"
|
||||
```
|
||||
|
||||
## 3. Clone the repo
|
||||
The following steps are made for Linux/mac environment
|
||||
1. Clone the git `git clone https://github.com/gcarq/freqtrade.git`
|
||||
2. (Optional) Checkout the develop branch `git checkout develop`
|
||||
### MacOS
|
||||
|
||||
#### 1. Install Python 3.6, git, wget and ta-lib
|
||||
|
||||
```bash
|
||||
brew install python3 git wget ta-lib
|
||||
```
|
||||
|
||||
#### 2. Install FreqTrade
|
||||
|
||||
Clone the git repository:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/freqtrade/freqtrade.git
|
||||
```
|
||||
|
||||
Optionally checkout the develop branch:
|
||||
|
||||
```bash
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
### Setup Config and virtual env
|
||||
|
||||
#### 1. Initialize the configuration
|
||||
|
||||
## 4. Prepare the bot
|
||||
```bash
|
||||
cd freqtrade
|
||||
cp config.json.example config.json
|
||||
```
|
||||
To edit the config please refer to [Bot Configuration](https://github.com/gcarq/freqtrade/blob/develop/docs/configuration.md)
|
||||
|
||||
## 5. Setup your virtual env
|
||||
> *To edit the config please refer to [Bot Configuration](https://github.com/freqtrade/freqtrade/blob/develop/docs/configuration.md).*
|
||||
|
||||
#### 2. Setup your Python virtual environment (virtualenv)
|
||||
|
||||
```bash
|
||||
python3.6 -m venv .env
|
||||
source .env/bin/activate
|
||||
pip3.6 install --upgrade pip
|
||||
pip3.6 install -r requirements.txt
|
||||
pip3.6 install -e .
|
||||
```
|
||||
|
||||
## 6. Run the bot
|
||||
If this is the first time you run the bot, ensure you are running it
|
||||
in Dry-run `"dry_run": true,` otherwise it will start to buy and sell coins.
|
||||
#### 3. Run the Bot
|
||||
|
||||
If this is the first time you run the bot, ensure you are running it in Dry-run `"dry_run": true,` otherwise it will start to buy and sell coins.
|
||||
|
||||
```bash
|
||||
python3.6 ./freqtrade/main.py -c config.json
|
||||
```
|
||||
|
||||
### Advanced Linux
|
||||
**systemd service file**
|
||||
Copy `./freqtrade.service` to your systemd user directory (usually `~/.config/systemd/user`)
|
||||
and update `WorkingDirectory` and `ExecStart` to match your setup.
|
||||
After that you can start the daemon with:
|
||||
------
|
||||
|
||||
## Windows
|
||||
|
||||
We recommend that Windows users use [Docker](#docker) as this will work much easier and smoother (also more secure).
|
||||
|
||||
If that is not possible, try using the Windows Linux subsystem (WSL) - for which the Ubuntu instructions should work.
|
||||
If that is not available on your system, feel free to try the instructions below, which led to success for some.
|
||||
|
||||
### Install freqtrade manually
|
||||
|
||||
#### Clone the git repository
|
||||
|
||||
```bash
|
||||
systemctl --user start freqtrade
|
||||
git clone https://github.com/freqtrade/freqtrade.git
|
||||
```
|
||||
|
||||
# Windows
|
||||
We do recommend Windows users to use [Docker](#docker) this will work
|
||||
much easier and smoother (also safer).
|
||||
copy paste `config.json` to ``\path\freqtrade-develop\freqtrade`
|
||||
|
||||
#### install ta-lib
|
||||
|
||||
Install ta-lib according to the [ta-lib documentation](https://github.com/mrjbq7/ta-lib#windows).
|
||||
|
||||
As compiling from source on windows has heavy dependencies (requires a partial visual studio installation), there is also a repository of inofficial precompiled windows Wheels [here](https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib), which needs to be downloaded and installed using `pip install TA_Lib‑0.4.17‑cp36‑cp36m‑win32.whl` (make sure to use the version matching your python version)
|
||||
|
||||
```cmd
|
||||
#copy paste config.json to \path\freqtrade-develop\freqtrade
|
||||
>cd \path\freqtrade-develop
|
||||
>python -m venv .env
|
||||
>cd .env\Scripts
|
||||
>activate.bat
|
||||
>cd \path\freqtrade-develop
|
||||
REM optionally install ta-lib from wheel
|
||||
REM >pip install TA_Lib‑0.4.17‑cp36‑cp36m‑win32.whl
|
||||
>pip install -r requirements.txt
|
||||
>pip install -e .
|
||||
>cd freqtrade
|
||||
>python main.py
|
||||
>python freqtrade\main.py
|
||||
```
|
||||
*Thanks [Owdr](https://github.com/Owdr) for the commands. Source: [Issue #222](https://github.com/gcarq/freqtrade/issues/222)*
|
||||
|
||||
## Next step
|
||||
Now you have an environment ready, the next step is to
|
||||
[configure your bot](https://github.com/gcarq/freqtrade/blob/develop/docs/configuration.md).
|
||||
> Thanks [Owdr](https://github.com/Owdr) for the commands. Source: [Issue #222](https://github.com/freqtrade/freqtrade/issues/222)
|
||||
|
||||
Now you have an environment ready, the next step is
|
||||
[Bot Configuration](https://github.com/freqtrade/freqtrade/blob/develop/docs/configuration.md)...
|
||||
|
||||
Reference in New Issue
Block a user