Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
LexStoicus opened this issue Dec 28, 2022 · 0 comments · Fixed by #347
Assignees
Labels
bug Something isn't working

Comments

@LexStoicus
Copy link

LexStoicus commented Dec 28, 2022

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.

@LexStoicus LexStoicus changed the title .sln file inside lean cli folder (where lean init was run) messes up with lean .sln file inside lean cli folder (where lean init was run) stops lean from running properly Dec 28, 2022
@Martin-Molinero Martin-Molinero added the bug Something isn't working label Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants