QuantConnect /Lean

Lean Algorithmic Trading Engine by QuantConnect (Python, C#)

★ 22,469⑂ 5,401
C#Created 2014-11-28lean.io
22,469
stars
+101+120+518
5,401
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions

README

              


[Lean Home][1] | [Documentation][2] | [Download Zip][3] | [Docker Hub][8] | [Nuget][9]




  
  
  


LEAN is an event-driven, professional-caliber algorithmic trading  platform built with a passion for elegant engineering and deep quant  concept modeling. Out-of-the-box alternative data and live-trading support.




  
  
  








  
  
  

LEAN is modular in design, with each component pluggable and customizable. It ships with models for all major plug-in points.




  
  
  





  
  
  




QuantConnect Lean CLI is a command-line interface tool for interacting with the Lean algorithmic trading engine, which is an open-source platform for backtesting and live trading algorithms in multiple financial markets. It allows developers to manage projects, run backtests, deploy live algorithms, and perform various other tasks related to algorithmic trading directly from the terminal. The CLI simplifies the workflow by automating tasks, enabling seamless integration with cloud services, and facilitating collaboration with the QuantConnect community. It's designed for quant developers who need a powerful and flexible tool to streamline their trading strategies. Please watch the instructions videos to learn more.

 Installation


pip install lean



 Commands

Create a new project containing starter code


lean project-create


Run a local Jupyter Lab environment using Docker


lean research


Backtest a project locally using Docker


lean backtest


Optimize a project locally using Docker


lean optimize


Start live trading a project locally using Docker


lean live


Download the LEAN CLI Cheat Sheet for the full list of commands.




  
  
  



!diagram




  
  
  



This section will cover how to install lean locally for you to use in your environment. For most users we strongly recommend the LEAN CLI which is prebuilt and runs on all platforms. Refer to the following readme files for a detailed guide regarding using your local IDE with Lean.


 VS Code
 VS
  
To install locally, download the zip file with the latest master and unzip it to your favorite location. Alternatively, install Git and clone the repo:


git clone https://github.com/QuantConnect/Lean.git
cd Lean


 macOS 

NOTE: Visual Studio for Mac has been discontinued, use Visual Studio Code instead

- Install Visual Studio Code for Mac
- Install the C Dev Kit extension
- Install dotnet 10 SDK:
- To build the solution, either:
  - choose Run Task  build from the Panel task dropdown, or
  - from the command line run
    
    dotnet build
    
- To run the solution, either:
  - choose Run and Debug from the Activity Bar, then click Launch, or
  - click F5, or
  - from the command line run
    
    cd Launcher/bin/Debug
    dotnet QuantConnect.Lean.Launcher.dll
    

 Linux (Debian, Ubuntu)

- Install dotnet 10:
- Compile Lean Solution:

dotnet build QuantConnect.Lean.sln

- Run Lean:

cd Launcher/bin/Debug
dotnet QuantConne

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON