Help on running new algorithm in LEAN Docker from Visual Studio

Back

I have VS setup with LEAN built. I have setup the LEAN Docker image. Running .\run_docker.bat works and running in PowerShell produces results from BasicTemplateFrameworkAlgorithm.py 

I've added a new algorythm .py file to the QuantConnect.Algorithm.Python folder rp.py

This file does not appear inside the VS folder view even after rebuild. 

My question is how can I compile the new algorithm .py script in VS and then run in the LEAN Docker image?

Thanks.

Update Backtest







 
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Visual Studios will only show files that are "included" in the .csproj. If you add the file using VS, (right click on the project and click "Add" => "New Item") this is done for you, but if you just add a file to the directory in your file explorer it won't show up in VS. You can either create a new file with the method above and copy over your contents, or manually change the .csproj using a text editor.

If you choose the manual method, all you need to do is open the .csproj, go to the tag <ItemGroup> and add an entry like:

<Content Include="AddRiskManagementAlgorithm.py" />

Once this is done, and VS reloads the project, you will now see the file in VS.


Now for Docker, all you need to do is make sure that your config is set properly (Algorithm settings) and that the file is indeed in the Algorithm.Python directory. Then you can use the "run_docker.bat" script just as before.

1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed