backtrader – a flexible tool for local backtests
backtrader is a popular, flexible, and user-friendly Python library for local backtests with great documentation, developed since 2015 by Daniel Rodriguez. In addition to a large and active community of individual traders, there are several banks and trading houses that use backtrader to prototype and test new strategies before porting them to a production-ready platform using, for example, Java. You can also use backtrader for live trading with several brokers of your choice (see the backtrader documentation and Chapter 23, Conclusions and Next Steps).
We'll first summarize the key concepts of backtrader to clarify the big picture of the backtesting workflow on this platform, and then demonstrate its usage for a strategy driven by ML predictions.
Key concepts of backtrader's Cerebro architecture
backtrader's Cerebro (Spanish for "brain") architecture represents the key components of the backtesting...