Hello all,
First I would like to congratulate the authors, contributors, and all the community for the awesome library/content provided.
Nowadays I'm a Sr. Data Scientist and a beginner in the field of trading investment strategies. After reading the documentation and going over some examples and discussions on the community, I wanted to contribute somehow. I noticed that there are a lot of similarities between Data Science experiments and backtesting trading strategies. One, in particular, is the parameters optimization of the strategy/machine learning model. The most simple approach is a grid search over a list of values for each parameter and their combination. In Data science this approach can be done by using GridsearchCV and I believe cerebro.optstrategy
has a similar method.
Another approach in Data Science that outsmarts grid search is Bayesian Optimization. With that in mind, I created a framework that is available in this repo for optimizing the possible parameters of a given trading strategy using Bayesian optimization.
Besides backtrader, it was used mainly three libraries:

Hydra: The key feature used in this project is the ability to dynamically create a hierarchical configuration by composition and override it through config files and the command line.

Bayesian Optimization: This is a constrained global optimization package built upon bayesian inference and gaussian process, that attempts to find the maximum value of an unknown function in as few iterations as possible.

backtrader_plotting: Library to add extended plotting capabilities to backtrader. Currently the only available backend is Bokeh.
This framework produces a series of metadata during the optimization process, which is saved in the directories created automatically by Hydra. This metadata includes a best_iteration.html
file showing the Bokeh plot of backtrader_plotting, a main.log
file describing step by step of the optimization process, and a STRATEGY_NAME.json
file containing the best set of parameters found by Bayesian optimization. After an experiment is concluded the main results are compiled and added to a results.csv
file to easily keep tracking of all possibilities that were tried.
Take a look at the README.md
and follow the steps to see these features running with a dummy example prepared.
I hope this can help some of you!
Regards,