This document contains information regarding ways to use Visual Studio to work with the Lean engine, this includes a couple options that make lean easy to develop on any machine:
-
Using Lean CLI -> A great tool for working with your algorithms locally, while still being able to deploy to the cloud and have access to Lean data. It is also able to run algorithms locally through our official docker images **Recommended for algorithm development.
-
Locally installing all dependencies to run Lean with Visual Studio on your OS.
To use Lean CLI follow the instructions for installation and tutorial for usage in our documentation.
-
Install .Net 6 for the project
-
(Optional) Get Python 3.8.13 for running Python algorithms
- Follow Python instructions here for your platform
-
Get Visual Studio
-
Get Lean into VS
- Download the repo or clone it using: git clone https://github.com/QuantConnect/Lean
- Open the project file with VS (QuantConnect.Lean.sln)
Your environment is prepared and ready to run lean
This section will cover configuring, launching and debugging lean. This is only applicable to option 2 from above. This does not apply to Lean CLI, please refer to CLI documentation
We need to be sure that our Lean configuration at .\Launcher\config.json is properly set.
Your configuration file should look something like this for the following languages:
"algorithm-type-name": "**AlgorithmName**",
"algorithm-language": "Python",
"algorithm-location": "../../../Algorithm.Python/**AlgorithmName**.py",
"algorithm-type-name": "**AlgorithmName**",
"algorithm-language": "CSharp",
"algorithm-location": "QuantConnect.Algorithm.CSharp.dll",
Now that lean is configured we can launch. Use Visual Studio's run option, Make sure QuantConnect.Lean.Launcher is selected as the launch project. Any breakpoints in Lean C# will be triggered.
Here we will cover some common issues with setting this up. Feel free to contribute to this section!