Trading Tools Directory
Backtesting.py logo

Backtesting.py

Backtesting.py is a small, free Python library for backtesting a strategy on any candlestick (OHLC) data you supply as a pandas DataFrame.

From
Free
Free plan
Open source
Platforms
Code
Markets
Stocks, Futures, Forex, Crypto
API
Not recorded
MCP server
None found

Plans

PlanPriceWhat it includes
Open sourceFreeFree plan, Open source (AGPL-3.0). No charge.

Free plan

Free: open-source library under AGPL-3.0 source

Good to know

Data must be supplied by the user as a pandas DataFrame with Open, High, Low, Close and optional Volume columns source

Details

Licence
AGPL-3.0 source
Latest release
0.6.6, uploaded to PyPI 2026-07-22 (no GitHub releases published) source
Language
Python source
Languages / strategy builder
Python Strategy subclasses source
Data included
Sample GOOG data in backtesting.test; otherwise user-supplied OHLC data source
Fill / slippage model documented
Yes: constant bid-ask spread and commission parameters (fixed, relative or callable). https://kernc.github.io/backtesting.py/doc/backtesting/backtesting.html source
Asset classes
Forex, crypto, stocks, futures (any candlestick data) vendor says · source
GitHub stars
9,270 on kernc/backtesting.py source
GitHub last push
5 Aug 2026 source
Licence (GitHub)
AGPL-3.0 source
Weekly downloads (PyPI)
53,489 last week for backtesting source