backtrader - Python backtesting¶
backtrader offers a complete backtesting/trading platform with this (not
fully comprehensive) list of features:
- Live Data Feed and Trading
- Datas with different timeframes can be mixed (days and weeks)
- Data Resampling
- Data Replaying (i.e: indicators/strategies see 5 bars in a weekly timeframe)
- Multiple Datas at the same Time
- Multiple Strategies at the same time
- Strategy optimization (including multicore support)
- Indicators (several) which can of course take datas and/or indicators as input
- TA-Lib support
- Plotting support for visual inspection
- Broker implementation with Market, Close, Limit, Stop, StopLimit orders
- Commission schemes supporting futures-like and stocks-like objects and customizable
- Performance analyzers including integration with
- Event based (strategy/indicator ‘next’ will be called with all subordinate indicators calculated and data fetched)
- Vector (in the form on inner tight for loops) based for a one shot calculation This applies to indicators ... Strategies always are executed one step at a time
- Natural python language/operations for Indicator development and object comparison/operations (arithmetic, logical operators) As much as permitted by Pthon overriding capabilities (if, and, or cannot be overriden ... but they are provided as logical functions)
- Index 0 approach to access the currently produced (or to be produced) data
- Index -1 approach to access the last produced data (to remain Pythonic)
The Blog Entries¶
184.108.40.206adds automatic inline plotting when running inside a Jupyter Notebook.
In the latest release the minor number has been moved from
9to indicate a change which may have some behavioral impact, regardless, even if compatibility has been taken into account.
Following some hints about an improved
SharpeRatio, backtrader has added this analyzer to its arsenal.
220.127.116.11of backtrader includes an improvement in how data feeds and results are managed during multiprocessing.
18.104.22.168smart staking was possible with backtrader over the Strategy methods:
sell. It was all about adding a
Sizerto the equation which is responsible for the size of the stake.