Installation FAQ

Q : Can I Run Liu on Windows?

I have a Windows-based environment. Can I use LiuAlgoTrader?

Answer

Yes. While LiuAlgoTrader is developed & tested on macOS and Linux (Debian), Liu can run on Windows with few minor adaptations.

Database Prerequisites

LiuAlgoTrader uses PostgreSQL as a database. Liu installation wizard installs and configures a local PostgreSQL using docker-compose. Postgres official docker image is based on Linux, and to run it on Windows machines, you need to make sure you can run Linux images on your Windows.

You will need to search online to allow Linux containers on your Windows machine; there are ample resources online. Note that depending on your Windows distribution, your hardware may be required to support Hyper-V.

To sum up, before installing Liu on your Windows, you need to make sure:

  1. Docker engine is installed and configured,
  2. Docker compose installed and configured,
  3. Your environment supports Linux containers

Trading Setup

It is OK to use Windows to develop strategies, but it is recommended to use Linux once you’re ready to move past back-testing. It is also recommended for the production environment to use a dedicated PostgreSQL setup (local, hosted, or managed) vs. running in the Dockerized background.

Running Liu applications

pip install liualgotrader installs 4 executables scripts (a.k.a applications): liu, trader, backtester and optimizer. On Windows (unlike Linux), it is not possible to execute the application by typing its name. You need to type python <path>liu. Where <path> depends on your local setup.

For example, assuming you have Python 3.9.x installed on your Windows machine, follow the steps bellow to create a dedicated virtual environment for Liu:

python -m venv liu
liu\Scripts\activate
pip install liualgotrader
python liu\Scripts\liu quickstart

Good Luck!

Windows Note: When quickstart says to run “env_vars.bat”, the set command only works in standard windows terminal, manually set the DSN in your shell by using the appropriate command for your shell.

Example:

Use this for Gitbash:

export DSN=connectionString

Use this for Windows PowerShell:

$env:VARIABLE_NAME=VALUE

Q : How to install on Ubuntu?

I would like to install liu on Ubuntu 20.10. Can you please list the steps I need to take?

Answer

STEP 1 : Install docker engine (Skip if already installed and running)

Follow the instructions for Docker installation. Then

$ sudo usermod -aG docker $USER

After successful completion of the above steps, you should logout and login.

STEP 2: Install docker-compose (Skip if already installed and working)

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.28.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose

STEP 3: Install Python3.9 and basic tools

$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt update
$ sudo apt install python3.9
$ sudo apt install python3-pip
$ sudo apt install python3.9-venv

STEP 4: Install LiuAlgoTrader

$ python3.9 -m venv liu
$ source liu/bin/activate
(liu) $ mkdir liu-dev ; cd liu-dev
(liu) $ pip install liualgotrader

STEP 5: Run installation wizard

make sre you have environment keys properly selected
(liu) $ liu quickstart