After you install the CLI, you need to create a workspace. Your workspace connects a directory on your local machine with one of your organizations in QuantConnect Cloud. Your workspace includes the basic files and folders necessary to use LEAN, including a local data directory and a LEAN configuration file.

We recommend running all Lean CLI commands in your root of your workspace 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 you run the LEAN engine on your local machine.

Create Workspaces

To create an workspace for one of your organizations, open a terminal in an empty directory, run lean init and then select an organization to link with the workspace. 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.

If you are running Docker on Windows using the legacy Hyper-V backend instead of the new WSL 2 backend, you need to enable file sharing for your temporary directories and for your workspace. To do so, open your Docker settings, go to Resources > File Sharing and add C: / Users / <username> / AppData / Local / Temp and your workspace path to the list. Click Apply & Restart after making the required changes.

To set the default language of new projects in a new workspace, run lean init --language <value> where the <value> is python or csharp.

Directory Structure

The lean init commands creates the following structure:

├── data/
│   ├── alternative/ 
│   ├── crypto/
│   ├── equity/
│   ├── ...
│   ├── market-hours/
│   ├── option/
│   ├── symbol-properties/
│   └──
└── lean.json

These files contain the following content:

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.

When you create new projects or pull existing projects from the cloud, your workspace stores the project files.

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: