Open-source project
Open-source project
Backtrader
A Python framework for expressing, testing and visualizing rule-based trading strategies on historical data.
- Provider
- Open-source community
- Access
- Open source
- Primary interface
- Python backtesting framework
Open-source community
API / Skill
Research
Model signal and order logic
Include realistic fees, slippage, survivorship and execution assumptions.
Open source · Python backtesting framework
Best used for
Model signal and order logic
Test strategies across assets
Analyze portfolio-level results
Quick start
pip install backtrader
import backtrader as bt
cerebro = bt.Cerebro()
cerebro.broker.setcash(100000)
# Add a data feed and strategy before running
results = cerebro.run()A practical workflow
- 1Confirm the source and license
- 2Run the smallest useful request
- 3Validate fields and missing values
- 4Cache responsibly and document assumptions
Before you build
Include realistic fees, slippage, survivorship and execution assumptions.
Frequently asked questions
What can Backtrader do in a real workflow?
Model signal and order logic Test strategies across assets Analyze portfolio-level results
What access and compatibility does Backtrader require?
Open source. Python backtesting framework.
What is the main implementation risk with Backtrader?
Include realistic fees, slippage, survivorship and execution assumptions.