Initialization

Workspace

Introduction

The Local Lab workspace is a directory that contains a data directory, a Lean configuration file, and all your project files. You need the data directory and a Lean configuration file to run the LEAN engine on your local machine.

Structure

The workspace directory initially has 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. The configuration is stored as JSON with support for both single-line and multiline comments. The Lean configuration file is based on the Launcher/config.json file from the Lean repository. When you create a new workspace, the latest version of this file is downloaded and stored on your local drive.

As you add projects to Local Lab, the project files are added to your workspace directory. If you create and use project libraries in your projects, the library files are added to a Library directory in your workspace.

Set the Workspace

Follow these steps to set the workspace directory:

  1. Log in to the Local Lab.
  2. In the left navigation menu, click the QuantConnect icon.
  3. In the Project panel, click Create LEAN Workspace or Select LEAN Workspace.
  4. You can create a new workspace directory or, if you use the LEAN CLI, you can set it to the CLI workspace.

  5. If you clicked Create LEAN Workspace, in the Create Lean CLI Workspace window, create a directory to serve as the workspace and then click Select.

It takes a few minutes to create a new workspace directory and populate it with the the initial file structure. To view the progress, see the purple bar at the bottom of Visual Studio Code.

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.

Change the Workspace

Follow these steps to change the workspace directory:

  1. Log in to the Local Lab.
  2. In the left navigation menu, click the QuantConnect icon.
  3. If a project is already open, in the Project panel, click Close.
  4. Click Change Here.
  5. In the Update Lean CLI Workspace window, click the new workspace directory and then click Select.
  6. The new workspace directory you select must have the correct structure.

Remove the Workspace

If you have set the workspace before and you want to initialize a new directory to serve as the workspace, remove the existing workspace and then set the workspace to a new directory.

Follow these steps to remove the existing workspace directory:

  1. Log in to the Local Lab.
  2. In Visual Studio Code, click File > Preferences > Settings.
  3. On the Settings page, click Extensions > QuantConnect.
  4. In the QC > Lean: Init field, remove the workspace path.
  5. Restart Visual Studio Code.

When you open Visual Studio Code again, it will prompt you to set the workspace.

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: