stable/docs/installation.md

265 lines
9.1 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
2021-01-22 16:32:57 +00:00
Please consider using the prebuilt [docker images](docker_quickstart.md) to get started quickly while evaluating how freqtrade works.
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:
2020-12-14 18:18:54 +00:00
* [Python >= 3.7.x](http://docs.python-guide.org/en/latest/starting/installation/)
2019-06-27 17:51:04 +00:00
* [pip](https://pip.pypa.io/en/stable/installing/)
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
2020-05-30 15:58:11 +00:00
* [virtualenv](https://virtualenv.pypa.io/en/stable/installation.html) (Recommended)
2019-06-27 17:51:04 +00:00
* [TA-Lib](https://mrjbq7.github.io/ta-lib/install.html) (install instructions below)
We also recommend a [Telegram bot](telegram-usage.md#setup-your-telegram-bot), which is optional but recommended.
2019-05-25 14:13:18 +00:00
!!! Warning "Up-to-date clock"
The clock on the system running the bot must be accurate, synchronized to a NTP server frequently enough to avoid problems with communication to the exchanges.
2018-12-31 10:04:22 +00:00
## Quick start
2019-05-25 14:13:18 +00:00
Freqtrade provides the Linux/MacOS Easy Installation script to install all dependencies and help you configure the bot.
2018-12-31 10:04:22 +00:00
2019-06-27 04:20:22 +00:00
!!! Note
Windows installation is explained [here](#windows).
The easiest way to install and run Freqtrade is to clone the bot Github repository and then run the Easy Installation script, if it's available for your platform.
!!! Note "Version considerations"
When cloning the repository the default working branch has the name `develop`. This branch contains all last features (can be considered as relatively stable, thanks to automated tests). The `stable` branch contains the code of the last release (done usually once per month on an approximately one week old snapshot of the `develop` branch to prevent packaging bugs, so potentially it's more stable).
!!! Note
2021-01-04 08:40:17 +00:00
Python3.7 or higher and the corresponding `pip` are assumed to be available. The install-script will warn you and stop if that's not the case. `git` is also needed to clone the Freqtrade repository.
Also, python headers (`python<yourversion>-dev` / `python<yourversion>-devel`) must be available for the installation to complete successfully.
This can be achieved with the following commands:
2019-06-27 04:20:22 +00:00
2018-12-31 10:04:22 +00:00
```bash
git clone https://github.com/freqtrade/freqtrade.git
2018-12-31 10:04:22 +00:00
cd freqtrade
# git checkout stable # Optional, see (1)
2018-12-31 10:04:22 +00:00
./setup.sh --install
```
(1) This command switches the cloned repository to the use of the `stable` branch. It's not needed if you wish to stay on the `develop` branch. You may later switch between branches at any time with the `git checkout stable`/`git checkout develop` commands.
2019-05-25 14:13:18 +00:00
## Easy Installation Script (Linux/MacOS)
If you are on Debian, Ubuntu or MacOS Freqtrade provides the script to install, update, configure and reset the codebase of 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/stable 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
With this option, the script will install the bot and most dependencies:
2020-12-14 18:18:54 +00:00
You will need to have git and python3.7+ installed beforehand for this to work.
2018-06-08 09:23:00 +00:00
2019-06-27 17:51:04 +00:00
* Mandatory software as: `ta-lib`
2020-09-11 19:01:45 +00:00
* Setup your virtualenv under `.env/`
This option is a combination of installation tasks, `--reset` and `--config`.
2018-12-31 10:04:22 +00:00
** --update **
2018-06-08 09:23:00 +00:00
This option will pull the last version of your current branch and update your virtualenv. Run the script with this option periodically to update your bot.
2018-12-31 10:04:22 +00:00
** --reset **
2018-06-08 09:23:00 +00:00
This option will hard reset your branch (only if you are on either `stable` or `develop`) and recreate your virtualenv.
2018-12-31 10:04:22 +00:00
** --config **
2018-06-08 09:23:00 +00:00
DEPRECATED - use `freqtrade new-config -c config.json` instead.
### Activate your virtual environment
2020-09-11 19:01:45 +00:00
Each time you open a new terminal, you must run `source .env/bin/activate`.
2020-09-11 19:01:45 +00:00
2018-01-13 02:36:12 +00:00
------
## Custom Installation
2020-11-30 19:56:14 +00:00
We've included/collected install instructions for Ubuntu, 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
2020-12-14 18:18:54 +00:00
Python3.7 or higher and the corresponding pip are assumed to be available.
2018-01-02 02:17:10 +00:00
2020-11-30 19:56:14 +00:00
=== "Ubuntu/Debian"
#### Install necessary dependencies
2018-01-13 02:36:12 +00:00
```bash
sudo apt-get update
sudo apt-get install build-essential git
```
2018-01-13 02:36:12 +00:00
=== "RaspberryPi/Raspbian"
2020-11-30 16:37:19 +00:00
The following assumes the latest [Raspbian Buster lite image](https://www.raspberrypi.org/downloads/raspbian/).
This image comes with python3.7 preinstalled, making it easy to get freqtrade up and running.
2018-01-02 02:17:10 +00:00
Tested using a Raspberry Pi 3 with the Raspbian Buster lite image, all updates applied.
2020-11-30 16:37:19 +00:00
``` bash
sudo apt-get install python3-venv libatlas-base-dev cmake
2020-11-30 16:37:19 +00:00
# Use pywheels.org to speed up installation
sudo echo "[global]\nextra-index-url=https://www.piwheels.org/simple" > tee /etc/pip.conf
2020-11-30 16:37:19 +00:00
git clone https://github.com/freqtrade/freqtrade.git
cd freqtrade
bash setup.sh -i
```
!!! Note "Installation duration"
Depending on your internet speed and the Raspberry Pi version, installation can take multiple hours to complete.
2020-11-30 16:37:19 +00:00
Due to this, we recommend to use the prebuild docker-image for Raspberry, by following the [Docker quickstart documentation](docker_quickstart.md)
!!! Note
The above does not install hyperopt dependencies. To install these, please use `python3 -m pip install -e .[hyperopt]`.
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
2020-02-01 13:06:31 +00:00
Use the provided ta-lib installation script
```bash
sudo ./build_helpers/install_ta-lib.sh
```
!!! Note
This will use the ta-lib tar.gz included in this repository.
##### TA-Lib manual installation
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
cd freqtrade
git checkout stable
2018-01-02 02:17:10 +00:00
```
#### 4. Install python dependencies
2018-01-13 02:36:12 +00:00
``` bash
python3 -m pip install --upgrade pip
python3 -m pip install -e .
2018-01-13 02:36:12 +00:00
```
#### 5. Initialize the configuration
2018-01-13 02:36:12 +00:00
```bash
# Initialize the user_directory
freqtrade create-userdir --userdir user_data/
2018-01-13 05:32:09 +00:00
2020-02-01 13:06:31 +00:00
# Create a new configuration file
freqtrade new-config --config config.json
2018-01-13 02:36:12 +00:00
```
> *To edit the config please refer to [Bot Configuration](configuration.md).*
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
2019-09-29 17:21:18 +00:00
freqtrade trade -c config.json
2018-01-13 02:36:12 +00:00
```
2021-01-22 16:32:57 +00:00
*Note*: If you run the bot on a server, you should consider using [Docker compose](docker_quickstart.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-11-30 19:35:13 +00:00
On Linux, as an optional post-installation task, you may wish to setup the bot to run as a `systemd` service or configure it to send the log messages to the `syslog`/`rsyslog` or `journald` daemons. See [Advanced Logging](advanced-setup.md#advanced-logging) for details.
------
### Anaconda
2019-08-05 17:25:43 +00:00
Freqtrade can also be installed using Anaconda (or Miniconda).
!!! Note
This requires the [ta-lib](#1-install-ta-lib) C-library to be installed first. See below.
2018-08-28 17:30:26 +00:00
``` bash
conda env create -f environment.yml
2018-08-28 17:30:26 +00:00
```
-----
2020-09-04 05:12:08 +00:00
## Troubleshooting
2020-01-02 13:52:34 +00:00
### MacOS installation error
Newer versions of MacOS may have installation failed with errors like `error: command 'g++' failed with exit status 1`.
2020-01-02 13:52:34 +00:00
This error will require explicit installation of the SDK Headers, which are not installed by default in this version of MacOS.
2020-01-02 13:52:34 +00:00
For MacOS 10.14, this can be accomplished with the below command.
``` bash
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
```
2020-09-04 05:12:08 +00:00
If this file is inexistent, then you're probably on a different version of MacOS, so you may need to consult the internet for specific resolution details.
### MacOS installation error with python 3.9
When using python 3.9 on macOS, it's currently necessary to install some os-level modules to allow dependencies to compile.
The errors you'll see happen during installation and are related to the installation of `tables` or `blosc`.
You can install the necessary libraries with the following command:
``` bash
brew install hdf5 c-blosc
```
After this, please run the installation (script) again.
2020-09-04 05:12:08 +00:00
-----
Now you have an environment ready, the next step is
[Bot Configuration](configuration.md).