Initialization

Directory Structure

Introduction

When running the lean init command, the CLI creates the basic files and folders necessary to use LEAN. These files include the local data directory and the LEAN configuration. This page documents exactly which files are created when running lean init.

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 Resources > File Sharing and add C:/Users/<username>/AppData/Local/Temp and your CLI root directory path to the list. Click Apply & Restart after making the required changes.

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/DirectoryDescription
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.jsonThis 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.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: