Reusing cerebro object
I am wondering is it possible to reuse cerebro object.
The use case is following:
- Add the data
- Add strategy
- Run the backtest
- Remove strategy
- Add another strategy.
- Run backtest
k-2. Remove the strategy
k-1. Add another trategy
k. Run backtest
My point is to keep the data loaded into memory and not recreate another cerebro object and load the data in order to back test again.
Is there an easy way to rewind the data and add different strategy.
Optimization tries to keep the data preloaded and in memory.
This post (Blog - Strategy Selection) details exactly the use case you have.
The SUO (Strategy Under Optimization) is really a Strategy Factory. It only shows 2 strategies and a
[0, 1]list to select either the 1st or the second. But you could also pass a
range(len(mylistofstrategies))and hold your strategies in that
Actually with some
metaclassprogramming, the strategies can register themselves in a master list, avoiding the manual addition of the new strategies to the list.
Thanks for the prompt response.
I will take a look @ the article.
See this update for: Blog - Strategy Selection Revisited