Installing the QuantConnect Lean ClI

Having some holiday time taking the new QuantConnect Lean CLI for a spin and see how easy it is to get it up and running and backtest a strategy.

QuantConnect Lean CLI

Recently i read a lot about algorithmic trading and stumbled upon QuantConnect.

For strategy implementation and backtesting i will use The Lean CLI. The Lean CLI is a cross-platform CLI aimed at making it easier to develop with the LEAN engine locally and in the cloud.

With Python and Docker installed the ClI is only one command away.

pip install --upgrade lean

If you get some path warnings - add ~/.local/bin to your PATH environment variable.

echo "export PATH=~/.local/bin:\${PATH}" >> ~/.bashrc
source ~/.bashrc

Test if lean is running

lean

If tkinter cannot be found as import

sudo apt-get install python3-tk

When everyhting works, open a terminal in an empty directory and run

lean init

Project creation is easy with

lean create-project "testing"

I already got some sample strategies in the cloud so lets log into lean and get my projects from the cloud

lean login
lean cloud pull

Backtesting in the cloud can be done via

lean cloud backtest "testing" --open --push

Works nicely

Erich Heil
Erich Heil
Consultant

Building data products.

Related