Back to Lean

Readme

.vs/readme.md

2.4.0.12.7 KB
Original Source
<h1>Local Development with Visual Studio</h1>

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.

<h1>Setup</h1> <h2>Option 1: Lean CLI</h2>

To use Lean CLI follow the instructions for installation and tutorial for usage in our documentation.

<h2>Option 2: Install Locally</h2>
  1. Install .Net 9 for the project

  2. (Optional) Get Python 3.11.11 for running Python algorithms

    • Follow Python instructions here for your platform
  3. Get Visual Studio

  4. Get Lean into VS

Your environment is prepared and ready to run lean

<h1>How to use Lean</h1>

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

<h2>Configuration</h2>

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:

<h3>Python:</h3>
"algorithm-type-name": "**AlgorithmName**",

"algorithm-language": "Python",

"algorithm-location": "../../../Algorithm.Python/**AlgorithmName**.py",
<h3>C#:</h3>
"algorithm-type-name": "**AlgorithmName**",

"algorithm-language": "CSharp",

"algorithm-location": "QuantConnect.Algorithm.CSharp.dll",
<h2>Launching Lean</h2>

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.

<h1>Common Issues</h1> Here we will cover some common issues with setting this up. Feel free to contribute to this section!