backtrader2 / backtrader

Python Backtesting library for trading strategies
https://www.backtrader.com
GNU General Public License v3.0
221 stars 52 forks source link

Enhancement: Optimized preloading of static pandas datafeeds #52

Open eicnix opened 3 years ago

eicnix commented 3 years ago

In my current setup preparing my pandas dataset on Cerebro start takes about ~40% of the whole execution time (in addition to actually loading the data from a database). This rather high portion is due to two points: The data is modified row-wise instead of column-wise and this process is executed once for every strategy optimization run. Giving the static nature of data during backtesting the dataframe can be prepared in a more efficient manner and cached between strategy optimization runs.