Projects
Project Management
Introduction
Creating new projects is an important feature of the Lean CLI. The CLI can automatically scaffold basic Python and C# projects, creating basic algorithm files, research notebooks, and the required editor configuration. Projects scaffolded by the CLI are similar to the ones created on QuantConnect, making it easy to switch between your local environment and the cloud.
Create Projects
Follow these steps to create a new Python project:
- Open a terminal in one of your organization workspaces.
- Run
lean project-create --language python "<projectName>"
to create a new project named <projectName>.$ lean project-create --language python "My Python Project" Successfully created Python project 'My Python Project'
Follow these steps to create a new C# project:
- Open a terminal in one of your organization workspaces.
- Run
lean project-create --language csharp "
to create a new C# project named <projectName>.<projectName>
"$ lean project-create --language csharp "My CSharp Project" Successfully created C# project 'My CSharp Project'
The project name must only contain -
, _
, letters, numbers, and spaces. The project name can't start with a space or be any of the following reserved names: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, or LPT9.
You can provide a project name containing forward slashes to create a project in a sub-directory. In case any of the given sub-directories does not exist yet, the CLI creates them for you.
Set the Default Language
It is also possible to set the default language to use when running lean project-create
:
- Run
lean config set default-language python
to set the default language to Python, after which you no longer need to provide the--language python
option to create Python projects.$ lean config set default-language python $ lean project-create "My Python Project" Successfully created Python project 'My Python Project'
- Run
lean config set default-language csharp
to set the default language to C#, after which you no longer need to provide the--language csharp
option to create C# projects.$ lean config set default-language csharp $ lean project-create "My CSharp Project" Successfully created C# project 'My CSharp Project'
Rename Projects
Follow these steps to rename a project that you have on your local machine and in QuantConnect Cloud:
- Open the organization workspaces on your local machine where you store the project.
- Rename the project file.
- Log in to the CLI if you haven't done so already.
- Open a terminal in the same organization workspace.
- Run
lean cloud push --project "<projectName>"
.
The project name must only contain -
, _
, letters, numbers, and spaces. The project name can't start with a space or be any of the following reserved names: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, or LPT9.
$ lean cloud push --project "My Renamed Project" [1/1] Pushing "My Renamed Project" Renaming project in the cloud from 'My Project' to 'My Renamed Project' Successfully updated name and files and libraries for 'My Project'
Alternatively, you can rename the project in QuantConnect Cloud and then pull the project to your local machine.
Delete Projects
Follow these steps to delete a project:
- Log in to the CLI if you haven't done so already.
- Open a terminal in the organization workspace that stores the project.
- Run
lean project-delete "<projectName>"
.
$ lean project-delete "My Project" Successfully deleted project 'My Project'
This command deletes the project on your local machine and in QuantConnect Cloud.
If you are a collaborator on the project, this command doesn't delete the project for the other collaborators, but it removes you as a collaborator.
Get Project Id
To get the project Id, open the <organizationWorkspace> / <projectName> / config.json file and look for the value of the local-id
or cloud-id
key. An example project Id is 13946911.