backtrader
BackTesting platform written in Python to test trading strategies.
Documentation
The blog:
Read the full documentation at readthedocs.org:
List of built-in Indicators (88)
Python 2/3 Support
- Python 2.6/2.7
- Python 3.2/3.3/3.4
Compatibility is tested during development with 2.7 and 3.4
The other versions are tested automatically with Travis.
Installation
From pypi:
pip install backtrader
pip install backtrader[matplotlib]
If matplotlib is not installed and you wish to do some plotting
From source:
Place the backtrader directory found in the sources inside your project
One dependency exists:
six
Features:
- Bar by Bar (next) operation or batch mode (once) operation
- Indicators and the addition of any custom end-user developed one
- Strategies
- Data Feeds from Online Sources or CSV Files (other forms could be implemented)
- Data Feeds with different timeframes
- Data Feed Resampling
- Data Feed Replaying
- A Broker implementation supporting
- Commision schemes for stocks and derivatives
- Orders: AtClose, AtMarket, AtLimit, Stop, StopLimit
- Position Sizers for the automatic determination of the stake
- Optimization of Strategies
- Plotting
Version numbering
X.Y.Z.I
- X: Major version number. Should stay stable unless something big is changed like an overhaul to use numpy
- Y: Minor version number. To be changed upon adding a complete new feature or (god forbids) an incompatible API change.
- Z: Revision version number. To be changed for documentation updates, small changes, small bug fixes
- I: Number of Indicators already built into the platform
Alternatives
If after seeing the docs (see also the example below) you feel this is not your cup of tea, you can always have a look at similar Python platforms: