Back

Local LEAN : How to Save and Load Backtest When Needed

How do I save the Backtest I had run in Local LEAN? How to I load it for later use ?

In QuantConnect website, I can load the backtest result I had run in the past . Is there anyway to do it in Local LEAN ? I can't find the instruction anywhere or I haven't tried it hard enough. I needed it to compare between backtest and not running it again in case I needed to see it.

Please help me. Thank you very much and sorry for my bad english.

Update Backtest








You can serialize the IResultHandler instance and write it to a JSON file.

Simply add the following two lines here:

var results = leanEngineAlgorithmHandlers.Results;
File.WriteAllText("pathToFile.json", JsonConvert.SerializeObject(results, Formatting.Indented));

And once the backtest is finished, you can retrieve all the relevant information from that file.

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.


@JayJayD : Thank you and sorry I totally forgot to mention this in my question. Can I load the json file into the Views handler ? So, it's like the "backtesting-desktop" environment with the charts and everything.

0

I don't know, sound reasonable but I never tried.

Maybe you can give it a shoot and share the experience with the community!

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.


there was once this LEAN Algorithm Monitor tool...i never tried it but maybe you want extend or just is it.

lean-algorithm-monitor

0

Description on the algorithm monitor:

Opening a file

The monitor can read exported JSON files (i.e. by the Quant Connect Algorithm Lab) or exported by the Monitor itself.

  • Star the application and provide the path to the .JSON file in the Open Session > From File tab.
  • When Monitor for changes has been enabled, the monitor will watch the file for changes. When they occur, all new data since the last time it has been opened will be appended.
0

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