QuantConnect/lean-cli

.sln file inside lean cli folder (where lean init was run) stops lean from running properly

Closed this issue · 0 comments

Imagine this scenario.
Setup lean cli to use C# as default language.
Create an empty folder i.e. lean-cli-test
Inside this folder you initialize lean (lean init)
Create a project (lean lean create-project MyTestProject)
If you execute lean backtest MyTestProject all works OK.
but
As soon you add this project to a .sln file inside the same folder lean-cli-test,
when you run lean backtest MyTestProject, you get error like below, and nothing is running.

Error: Document is empty, line 1, column 1 (, line 1)

This below approach I want to use because I might have different trading strategies, each with its own market/logic etc.
Each strategy is a separate project. (.csproj)

So, I can write several C# strategies, meaning several C# projects and I want a single Visual Studio solution containing grouped together all these strategies ( C# individual projects).

But i cannot do this because lean does not work anymore reporting document is empty error like above.

So instead to have a GitHub repo with my solution (.sln file) with all my strategies, which i can clone it and then inside the same folder to execute lean init and use my purchased historical data for local back-testing, I have to clone my solution is a separate folder, have lean cli in another folder, and then manually copy what project I want to work with inside lean folder.

But this, beside being a messy approach it also makes my git approach not working as intended as well (from a git flow pov)

So in short, please allow lean to run and execute backtests even .sln files are in the same folder where lean.json is (where lean init happened).

I think this is happening because lean is making use of MSBuild and based on what parameters are sent to MSBuild, having a .sln inside the same folder messes things a little.

I think bug fix is around the set_up_csharp_options function in lean_runner.py combined with the get_csharp_compile_root function.
I would need to familiarize more with lean cli python code first before I could try fixing it by myself (as today I am looking at it for the first time ever)

Thank you.