A few things.
Currently I have the Coarse and Fine Selector turned off. I can turn them on and the algo will take trades based off the stocks it finds, but I dont believe those tickers are getting passed into the ML portion of the algo. Is this possible to combine both a dynamic and static set of tickers? If not, how would I go about using only the Coarse selector? I suspect using OnSecuritiesChanges and then from there?
What is the best way to test optimizers such as MaximumSharpeRatioPortfolioOptimizer or another? It would seem I need to create more parameters within the lines for example?
# Initialize instance of Random Forest Regressor
regressor = RandomForestRegressor(n_estimators=100, min_samples_split=5, random_state = 1990)
I see the Optimizer tab, however it would appear that its just a faster, more thorough version of a backtest, except you have to pay for it. Is that about right?
Additionally, any general feedback when it comes to running Random Forest ML in algos here would be greatly appreciated.
Adam W
The MaximumSharpeRatio optimizer you mentioned can be thought of as just a special case of portfolio mean-variance optimization with a different objective function. From a quick glance at the code, seems like usage would be something like
The Optimizer tab (not to be confused with the portfolio optimizer class you mentioned) can be used for tuning the hyperparameters of your algo. E.g. running a grid search over `n_estimators` in your random forest
Varad Kabade
Hi Axist,
Is this possible to combine both a dynamic and static set of tickers?
Yes, it is possible.Refer to the following thread. As we already have a dynamic universe adding securities manually may lead to survivorship-bias in the algorithm
If not, how would I go about using only the Coarse selector? I suspect using OnSecuritiesChanges and then from there?
We can store the list of selected securities with the help of the OnSecuritiesChanged event handler. Refer to the following code snippet.
Refer to the following thread for more information about using the optimizer.
What is the best way to test optimizers such as MaximumSharpeRatioPortfolioOptimizer or another?
The MaximumSharpeRatioPortfolioOptimizer is designed to optimize portfolio weights using historical returns of the securities. To create a SciPy optimizer that optimizes the first two arguments passed to the RandomForestRegressor, a new optimizer would need to be created. Please refer to this SciPy tutorial for more information.
We have updated the above algorithm where we use manual Universe selection using only the coarse function and keep track of the added securities in the OnSecuritiesChanged event handler. Note that we can increase the speed of backtest consistently by removing the History call again and again. We can store the historical data in a rolling window and keep it updating with the help of a consolidator. Refer to the attached backtest.
Best,
Varad Kabade
Axist
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!