Package backtesting

xkcd.com/1570

Manuals

Tutorials

These tutorials are also available as live Jupyter notebooks: Binder Google Colab
In Colab, you might have to !pip install backtesting.

Example Strategies

  • (contributions welcome)

Tip

For an overview of recent changes, see What's New.

FAQ

Some answers to frequent and popular questions can be found on the issue tracker or on the discussion forum on GitHub. Please use the search!

License

This software is licensed under the terms of AGPL 3.0, meaning you can use it for any reasonable purpose and remain in complete ownership of all the excellent trading strategies you produce, but you are also encouraged to make sure any upgrades to Backtesting.py itself find their way back to the community.

API Reference Documentation

Sub-modules

backtesting.backtesting

Core framework data structures. Objects from this module can also be imported from the top-level module directly, e.g …

backtesting.lib

Collection of common building blocks, helper auxiliary functions and composable strategy classes for reuse …

backtesting.test

Data and utilities for testing.