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.
JayJayD
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.
Albert Kamord
@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.
JayJayD
I don't know, sound reasonable but I never tried.
Maybe you can give it a shoot and share the experience with the community!
Michael Manus
there was once this LEAN Algorithm Monitor tool...i never tried it but maybe you want extend or just is it.
lean-algorithm-monitor
Michael Manus
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..JSON
file in theOpen Session > From File
tab.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.Albert Kamord
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!