# mementum/backtrader

Python Backtesting library for trading strategies

Repository: https://github.com/mementum/backtrader
Canonical: https://ross.abutalabs.com/products/backtrader
Homepage: https://www.backtrader.com
Language: Python
License: GPL-3.0
License Family: copyleft
Topics: python, trading, backtesting, metaclass
Last push: 2024-08-19T17:47:36+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 4253, "days_push": 744, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 22978, forks 5248 (observed 2026-08-28T04:11:34.280651+00:00)

## What it is
Backtrader is a feature-rich Python framework for backtesting trading strategies and live trading, with built-in indicators, data feeds, brokers, and performance analyzers. It lets users write reusable strategies and indicators while handling the event-driven execution engine, plotting, and broker simulation infrastructure.

## Use cases
- backtest a moving average crossover strategy on historical stock data
- simulate trading strategies with market, limit, stop, and bracket orders
- test strategies across multiple timeframes and multiple data feeds
- connect to Interactive Brokers or Oanda for live trading
- compute technical indicators like RSI, MACD, and SMA over price series
- analyze strategy performance with returns and trade analyzers
- resample or replay daily bars into intraday chunks

## When to choose
- you want a batteries-included Python backtesting engine with 120+ built-in indicators
- you need both backtesting and live trading through the same codebase
- you want built-in charting and performance analyzers without extra tooling
- you prefer a self-contained library with minimal external dependencies

## When to avoid
- you need actively maintained software with recent Python version guarantees
- you require vectorized backtesting at scale for large parameter sweeps
- you need modern broker integrations beyond community-maintained third-party extensions
- you want a lightweight custom backtester you fully control

## Facets
- artifact type: framework
- maturity: maintenance
- function: trading, simulation, data-visualization, benchmarking
- domain: fintech, data-science
- platform: python, cross-platform
- tags: backtesting, algorithmic-trading, technical-analysis, indicators, live-trading, interactive-brokers, oanda, finance, trading, python

## Member repositories
- mementum/backtrader (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:34.280651+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T16:56:49.646440+00:00, confidence not recorded.
  - readme: https://github.com/mementum/backtrader (fetched 2026-08-28T04:11:34.280651+00:00, sha 855d2fca6e4f)
  - homepage: https://www.backtrader.com (fetched 2026-08-29T07:54:58.948860+00:00, sha 2ef6408e1474)
  - site_page: https://www.backtrader.com/home/features (fetched 2026-08-29T07:54:58.959418+00:00, sha 2e271a08ea38)
  - site_page: https://www.backtrader.com/docu/installation (fetched 2026-08-29T07:54:58.961258+00:00, sha ab49c8aa384f)
  - site_page: https://www.backtrader.com/docu/quickstart/quickstart (fetched 2026-08-29T07:54:58.962848+00:00, sha beee12f951d7)
  - registry_pypi: https://pypi.org/pypi/backtrader/json (fetched 2026-08-29T07:54:58.965934+00:00, sha 16ac8651fec5)
  - site_page: https://www.backtrader.com/docu (fetched 2026-08-29T07:54:58.957766+00:00, sha d2aa6d66f614)
- Data as of 2026-08-30T08:39:29.467469+00:00.
