The algorithm parameters (a.k.a project parameters) are currently being used only as default values, and are only useful when using the optimiser. I think that with minimal adjustments we could use them for standard backtests, adding great value!
- Given that the parameters are stored along with the project, they cannot really be called parameters, as changing them in order to run a backtest actually changes the state of the project.
- currently writing GetParameter("param-name") and adding “param-name” as a parameter but leaving it as an empty string will cause an exception to occur whenever starting an algorithm. I suggest instead that if some parameters do not have a default value, after clicking the backtest button display a form to allow filling them in (or with the lean cloud backtest command to be able to pass an option --parameters listing them as string or file path).
- currently backtest results do not leave a trace of which values were used for the parameters. This could be vital to reconstruct what has been done to achieve the backtest result. As we have access to the code for a specific backtest run, it would only make sense to have a page with the parameters used listed out. (btw the library code / shared code used at that time would also be important to have, as it might change in time).
This would make it much easier to identify a backtest run, as currently I am using titles to describe which parameters were used, and if too many I have to go and look at the code. Also, together with being able to lock a project, this would make it way more realistic and safer to collaborate on a project with somebody who is not very familiar or scared to touch autosaving code ;) It might allow in the future to be able to search for a backtest run by parameter value, and many other things.What do you think?
Varad Kabade
Hi R G Quant,
Thank you for your feature recommendation; we will really put it into our pipeline. We can use the GetParamter like mentioned above suppose if there is no parameter, then the variable would be none we can use an if statement to give the default value in this case:
We have an open GitHub issue; subscribe to the following for updates:
https://github.com/QuantConnect/Lean/issues/4881
Best,
Varad Kabade
Kai Kramer
+1
Hi, I support request of the parameters for the backtest only. I also use the parameters to run different backtest and find it unhandy to note the parameters separately.
Also I plead for the lean -parameters option.
Postbio
I would like to express support for a command line Lean and/or API call to invoke cloud backtests that can also take a set of parameters.
The use case would be an automated job that runs many backtests, each with a different set of the entire space of N params, with each parameter taking on some specified values, and exploring the parameter space and values completely or partially.
The hack for now I'm thinking of is to add to a project a “parameters.json” or “parameters.csv” project file that can be created right before a backtest, then pushing the project to the cloud, and then running the lean cloud backtest.
There might be a more functional way, but I'm relatively new to this and this is how I'd explore the parameter space automatedly using the QC API, rather than sitting in front of the Cloud Terminal and manually starting new backtests after changing parameters.
Yuri Lopukhov
postbio you cannot read json or csv file directly, because open() function is not white-listed. Perhaps it is possible to load csv via pandas or some other library indirectly though. You can also use Python file to store parameters in global variables and import them. This is how I usually do, I only use LEAN parameters for cloud optimization, because there is no other option there.
Also, they really don't like somebody to run too many backtests on backtesting nodes in automated way. They say they are not optimized for this and suggest using cloud optimization feature instead. There are no hard limits as far as I know, but eventually they may appear.
Postbio
Hi Yuri,
Ah, I see. I suppose one way to handle this…
R G Quant
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!