Initialization

Workspace

Introduction

A 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, the project files are added to your workspace directory. If you create and use shared libraries in your projects, the library files are added to a Library directory in your workspace.

Pull Cloud Workspaces

Follow these steps to pull one of your cloud workspaces and set it as your local workspace:

  1. Log in to the local platform.
  2. In the left navigation menu, click the VS Code QuantConnect icon QuantConnect icon.
  3. In the Select Workspace panel, click Pull Organization Workspace.
  4. Select workspace
  5. In the Pull QuantConnect Organization Workspace window, click the cloud workspace (organization) that you want to pull.
  6. Pull cloud organization
  7. In the Pull QuantConnect Organization Workspace window, create a directory to serve as the workspace and then click Select.
  8. Pull cloud workspace

It takes a few minutes to create a new workspace directory and populate it with the the initial file structure. After the workspace directory is populated with the initial file structure, it pulls your cloud project files.

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.

Use Local Workspaces

If you have pulled a cloud workspace before or have set up a CLI workspace, you can set it as your current workspace.

Follow these steps to connect to workspace that's already on your local machine:

  1. Log in to the local platform.
  2. In the left navigation menu, click the VS Code QuantConnect icon QuantConnect icon.
  3. In the Select Workspace panel, click Use Existing Organization Workspace.
  4. Select workspace
  5. In the Update Organization Workspace window, navigate to the workspace directory and then click Select.
  6. Update organization workspace

Change Workspaces

Follow these steps to change the workspace directory:

  1. Log in to the local platform.
  2. In the left navigation menu, click the VS Code QuantConnect icon QuantConnect icon.
  3. If a project is already open, close it.
  4. In the Open Project panel, click Change.
  5. Change workspace panel
  6. Pull a cloud workspace or use a local 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: