Initialization
Directory Structure
lean init
After installing the CLI, open a terminal in an empty directory and run lean init
to create your CLI root directory.
This command scaffolds a standard directory structure containing a data directory and a Lean configuration file, both of which are required to run the LEAN engine locally.
We recommend running all Lean CLI commands in your CLI root directory.
If you are running Docker on Windows using the legacy Hyper-V backend instead of the new WSL 2 backend, you also need to enable file sharing for your temporary directories and for your CLI root directory. To do so, open your Docker settings, go to C:/Users/<username>/AppData/Local/Temp and your CLI root directory path to the list. Click after making the required changes.
and add lean init
creates the following structure:
. ├── data/ │ ├── alternative/ │ ├── cfd/ │ ├── crypto/ │ ├── equity/ │ ├── forex/ │ ├── future/ │ ├── futureoption/ │ ├── index/ │ ├── indexoption/ │ ├── market-hours/ │ ├── option/ │ ├── symbol-properties/ │ └── readme.md └── lean.json
These files contain the following content:
File/Directory | Description |
---|---|
data/ | This directory contains the local data that is used when running the LEAN engine locally. This directory is filled with sample data from the QuantConnect/Lean repository. |
lean.json | This file contains the Lean configuration that is used when running the LEAN engine locally. |
We recommend running all Lean CLI commands in your CLI root directory. Doing so ensures the directory structure is always kept consistent when synchronizing projects between the cloud and your local drive. It also makes it possible for the CLI to automatically find the Lean configuration file when running the LEAN engine locally.