stable/docs/installation.md

260 lines
8.5 KiB
Markdown
Raw Normal View History

2018-01-13 02:36:12 +00:00
# Installation
2019-05-25 14:13:18 +00:00
2018-01-09 04:27:41 +00:00
This page explains how to prepare your environment for running the bot.
2018-01-13 02:36:12 +00:00
2018-12-31 10:04:22 +00:00
## Prerequisite
2019-05-25 14:13:18 +00:00
2019-06-27 17:51:04 +00:00
### Requirements
Click each one for install guide:
* [Python >= 3.6.x](http://docs.python-guide.org/en/latest/starting/installation/)
* [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) (install instructions below)
### API keys
2018-12-31 10:04:22 +00:00
Before running your bot in production you will need to setup few
2019-05-25 14:27:36 +00:00
external API. In production mode, the bot will require valid Exchange API
2019-06-23 19:51:33 +00:00
credentials. We also recommend a [Telegram bot](telegram-usage.md#setup-your-telegram-bot) (optional but recommended).
2018-01-13 02:36:12 +00:00
2018-12-31 10:04:22 +00:00
### Setup your exchange account
2019-05-25 14:13:18 +00:00
2019-05-25 14:27:36 +00:00
You will need to create API Keys (Usually you get `key` and `secret`) from the Exchange website and insert this into the appropriate fields in the configuration or when asked by the installation script.
2019-05-25 14:13:18 +00:00
2018-12-31 10:04:22 +00:00
## Quick start
2019-05-25 14:13:18 +00:00
2018-12-31 10:04:22 +00:00
Freqtrade provides a Linux/MacOS script to install all dependencies and help you to configure the bot.
2019-06-27 04:20:22 +00:00
!!! Note
Python3.6 or higher and the corresponding pip are assumed to be available. The install-script will warn and stop if that's not the case.
2018-12-31 10:04:22 +00:00
```bash
git clone git@github.com:freqtrade/freqtrade.git
cd freqtrade
git checkout develop
./setup.sh --install
```
2019-05-25 14:13:18 +00:00
2018-12-31 10:04:22 +00:00
!!! Note
2018-12-31 13:00:36 +00:00
Windows installation is explained [here](#windows).
2019-05-25 14:13:18 +00:00
## Easy Installation - Linux Script
2019-06-27 17:51:04 +00:00
If you are on Debian, Ubuntu or MacOS freqtrade provides a script to Install, Update, Configure, and Reset your bot.
```bash
$ ./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).
```
2018-12-31 10:04:22 +00:00
** --install **
2018-06-08 09:23:00 +00:00
This script will install everything you need to run the bot:
2018-06-08 09:23:00 +00:00
2019-06-27 17:51:04 +00:00
* Mandatory software as: `ta-lib`
* Setup your virtualenv
* Configure your `config.json` file
This script is a combination of `install script` `--reset`, `--config`
2018-12-31 10:04:22 +00:00
** --update **
2018-06-08 09:23:00 +00:00
Update parameter will pull the last version of your current branch and update your virtualenv.
2018-12-31 10:04:22 +00:00
** --reset **
2018-06-08 09:23:00 +00:00
Reset parameter will hard reset your branch (only if you are on `master` or `develop`) and recreate your virtualenv.
2018-12-31 10:04:22 +00:00
** --config **
2018-06-08 09:23:00 +00:00
Config parameter is a `config.json` configurator. This script will ask you questions to setup your bot and create your `config.json`.
2018-01-13 02:36:12 +00:00
------
## 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.
2018-12-31 10:04:22 +00:00
OS Specific steps are listed first, the [Common](#common) section below is necessary for all systems.
2018-01-13 02:36:12 +00:00
2019-06-27 17:51:04 +00:00
!!! Note
Python3.6 or higher and the corresponding pip are assumed to be available.
2018-01-02 02:17:10 +00:00
2018-01-13 02:36:12 +00:00
### Linux - Ubuntu 16.04
2019-06-27 17:51:04 +00:00
#### Install necessary dependencies
2018-01-13 02:36:12 +00:00
2018-01-02 02:17:10 +00:00
```bash
sudo apt-get update
2019-06-27 17:51:04 +00:00
sudo apt-get install build-essential git
2018-01-02 02:17:10 +00:00
```
#### Raspberry Pi / Raspbian
Before installing FreqTrade on a Raspberry Pi running the official Raspbian Image, make sure you have at least Python 3.6 installed. The default image only provides Python 3.5. Probably the easiest way to get a recent version of python is [miniconda](https://repo.continuum.io/miniconda/).
The following assumes that miniconda3 is installed and available in your environment. Since the last miniconda3 installation file uses python 3.4, we will update to python 3.6 on this installation.
It's recommended to use (mini)conda for this as installation/compilation of `numpy` and `pandas` takes a long time.
Additional package to install on your Raspbian, `libffi-dev` required by cryptography (from python-telegram-bot).
``` bash
conda config --add channels rpi
conda install python=3.6
conda create -n freqtrade python=3.6
conda activate freqtrade
conda install pandas numpy
sudo apt install libffi-dev
python3 -m pip install -r requirements-common.txt
python3 -m pip install -e .
```
!!! Note
This does not install hyperopt dependencies. To install these, please use `python3 -m pip install -e .[hyperopt]`.
2019-09-26 07:31:31 +00:00
We do not advise to run hyperopt on a Raspberry Pi, since this is a very resource-heavy operation, which should be done on powerful machine.
2018-12-31 10:04:22 +00:00
### Common
2018-08-26 18:09:12 +00:00
#### 1. Install TA-Lib
2018-01-13 02:36:12 +00:00
2018-01-02 02:17:10 +00:00
Official webpage: https://mrjbq7.github.io/ta-lib/install.html
2018-01-13 02:36:12 +00:00
```bash
2018-01-02 02:17:10 +00:00
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
sed -i.bak "s|0.00000001|0.000000000000000001 |g" src/ta_func/ta_utility.h
./configure --prefix=/usr/local
2018-01-02 02:17:10 +00:00
make
sudo make install
2018-01-02 02:17:10 +00:00
cd ..
rm -rf ./ta-lib*
```
2018-12-31 10:04:22 +00:00
!!! Note
An already downloaded version of ta-lib is included in the repository, as the sourceforge.net source seems to have problems frequently.
2018-01-13 02:36:12 +00:00
2018-08-26 18:09:12 +00:00
#### 2. Setup your Python virtual environment (virtualenv)
2018-01-13 02:36:12 +00:00
2018-12-31 10:04:22 +00:00
!!! Note
This step is optional but strongly recommended to keep your system organized
2018-01-13 02:36:12 +00:00
```bash
2018-08-26 18:09:12 +00:00
python3 -m venv .env
source .env/bin/activate
2018-01-13 02:36:12 +00:00
```
#### 3. Install Freqtrade
2018-01-02 02:17:10 +00:00
2018-01-13 02:36:12 +00:00
Clone the git repository:
2018-01-02 02:17:10 +00:00
```bash
git clone https://github.com/freqtrade/freqtrade.git
2018-08-26 18:09:12 +00:00
2018-01-02 02:17:10 +00:00
```
2019-06-27 17:51:04 +00:00
Optionally checkout the master branch to get the latest stable release:
2018-01-02 02:17:10 +00:00
```bash
2018-08-26 18:09:12 +00:00
git checkout master
2018-01-02 02:17:10 +00:00
```
2018-08-26 18:09:12 +00:00
#### 4. Initialize the configuration
2018-01-13 02:36:12 +00:00
```bash
cd freqtrade
cp config.json.example config.json
```
2018-12-31 13:00:36 +00:00
> *To edit the config please refer to [Bot Configuration](configuration.md).*
2018-01-13 02:36:12 +00:00
2018-08-26 18:09:12 +00:00
#### 5. Install python dependencies
2018-01-13 05:32:09 +00:00
2018-08-26 18:09:12 +00:00
``` bash
2019-06-27 17:51:04 +00:00
python3 -m pip install --upgrade pip
python3 -m pip install -e .
2018-01-13 02:36:12 +00:00
```
2018-08-26 18:09:12 +00:00
#### 6. Run the Bot
2018-01-13 05:32:09 +00:00
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.
2018-01-13 02:36:12 +00:00
```bash
freqtrade -c config.json
2018-01-13 02:36:12 +00:00
```
2019-05-25 14:13:18 +00:00
*Note*: If you run the bot on a server, you should consider using [Docker](docker.md) or a terminal multiplexer like `screen` or [`tmux`](https://en.wikipedia.org/wiki/Tmux) to avoid that the bot is stopped on logout.
2018-08-26 18:09:12 +00:00
#### 7. (Optional) Post-installation Tasks
2018-08-26 18:09:12 +00:00
2019-10-26 12:41:31 +00:00
On Linux, as an optional post-installation task, you can setup the bot to run as a `systemd` service. See [Advanced Post-installation Tasks](advanced-setup.md) for details.
------
2019-08-05 17:25:43 +00:00
## Using Conda
Freqtrade can also be installed using Anaconda (or Miniconda).
``` bash
conda env create -f environment.yml
```
2019-08-22 04:57:32 +00:00
!!! Note
2019-08-05 17:25:43 +00:00
This requires the [ta-lib](#1-install-ta-lib) C-library to be installed first.
## Windows
2019-05-25 14:13:18 +00:00
We recommend that Windows users use [Docker](docker.md) as this will work much easier and smoother (also more secure).
2018-06-08 09:23:00 +00:00
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.
2018-06-08 09:23:00 +00:00
### Install freqtrade manually
#### Clone the git repository
```bash
git clone https://github.com/freqtrade/freqtrade.git
```
2018-08-28 17:30:26 +00:00
#### Install ta-lib
2018-06-08 09:23:00 +00:00
Install ta-lib according to the [ta-lib documentation](https://github.com/mrjbq7/ta-lib#windows).
2018-12-31 10:12:56 +00:00
As compiling from source on windows has heavy dependencies (requires a partial visual studio installation), there is also a repository of unofficial precompiled windows Wheels [here](https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib), which needs to be downloaded and installed using `pip install TA_Lib0.4.17cp36cp36mwin32.whl` (make sure to use the version matching your python version)
2018-06-08 09:23:00 +00:00
```cmd
>cd \path\freqtrade-develop
>python -m venv .env
>.env\Scripts\activate.bat
2018-06-08 09:23:00 +00:00
REM optionally install ta-lib from wheel
REM >pip install TA_Lib0.4.17cp36cp36mwin32.whl
>pip install -r requirements.txt
>pip install -e .
>freqtrade
```
> Thanks [Owdr](https://github.com/Owdr) for the commands. Source: [Issue #222](https://github.com/freqtrade/freqtrade/issues/222)
2018-08-28 17:30:26 +00:00
#### Error during installation under Windows
``` bash
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
```
Unfortunately, many packages requiring compilation don't provide a pre-build wheel. It is therefore mandatory to have a C/C++ compiler installed and available for your python environment to use.
2019-05-25 14:13:18 +00:00
The easiest way is to download install Microsoft Visual Studio Community [here](https://visualstudio.microsoft.com/downloads/) and make sure to install "Common Tools for Visual C++" to enable building c code on Windows. Unfortunately, this is a heavy download / dependency (~4Gb) so you might want to consider WSL or [docker](docker.md) first.
2018-08-28 17:30:26 +00:00
---
2018-01-13 02:36:12 +00:00
Now you have an environment ready, the next step is
2018-12-31 12:39:18 +00:00
[Bot Configuration](configuration.md).