Skip to main content

A flexible backtesting framework for Python

Project description

http://pmorissette.github.io/bt/_static/logo.png https://travis-ci.org/pmorissette/bt.svg?branch=master https://codecov.io/gh/pmorissette/bt/branch/master/graph/badge.svg

bt - Flexible Backtesting for Python

bt is currently in alpha stage - if you find a bug, please submit an issue.

Read the docs here: http://pmorissette.github.io/bt.

What is bt?

bt is a flexible backtesting framework for Python used to test quantitative trading strategies. Backtesting is the process of testing a strategy over a given data set. This framework allows you to easily create strategies that mix and match different Algos. It aims to foster the creation of easily testable, re-usable and flexible blocks of strategy logic to facilitate the rapid development of complex trading strategies.

The goal: to save quants from re-inventing the wheel and let them focus on the important part of the job - strategy development.

bt is coded in Python and joins a vibrant and rich ecosystem for data analysis. Numerous libraries exist for machine learning, signal processing and statistics and can be leveraged to avoid re-inventing the wheel - something that happens all too often when using other languages that don’t have the same wealth of high-quality, open-source projects.

bt is built atop ffn - a financial function library for Python. Check it out!

Features

  • Tree Structure

    The tree structure facilitates the construction and composition of complex algorithmic trading strategies that are modular and re-usable. Furthermore, each tree Node has its own price index that can be used by Algos to determine a Node’s allocation.

  • Algorithm Stacks

    Algos and AlgoStacks are another core feature that facilitate the creation of modular and re-usable strategy logic. Due to their modularity, these logic blocks are also easier to test - an important step in building robust financial solutions.

  • Charting and Reporting

    bt also provides many useful charting functions that help visualize backtest results. We also plan to add more charts, tables and report formats in the future, such as automatically generated PDF reports.

  • Detailed Statistics

    Furthermore, bt calculates a bunch of stats relating to a backtest and offers a quick way to compare these various statistics across many different backtests via Results’ display methods.

Roadmap

Future development efforts will focus on:

  • Speed

    Due to the flexible nature of bt, a trade-off had to be made between usability and performance. Usability will always be the priority, but we do wish to enhance the performance as much as possible.

  • Algos

    We will also be developing more algorithms as time goes on. We also encourage anyone to contribute their own algos as well.

  • Charting and Reporting

    This is another area we wish to constantly improve on as reporting is an important aspect of the job. Charting and reporting also facilitate finding bugs in strategy logic.

Installing bt

The easiest way to install bt is from the Python Package Index using pip or easy_insatll:

$ pip install bt

Since bt has many dependencies, we strongly recommend installing the Anaconda Scientific Python Distribution, especially on Windows. This distribution comes with many of the required packages pre-installed, including pip. Once Anaconda is installed, the above command should complete the installation.

bt should be compatible with Python 2.7 and Python 3 thanks to the contributions made by fellow users.

Special Thanks

A special thanks to the following contributors for their involvement with the project:

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bt-0.2.6.tar.gz (2.7 MB view details)

Uploaded Source

File details

Details for the file bt-0.2.6.tar.gz.

File metadata

  • Download URL: bt-0.2.6.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bt-0.2.6.tar.gz
Algorithm Hash digest
SHA256 9f7102145542177b1aa17fceae8667a681485c3e5f75d28fcba1d57382a3a72a
MD5 addb9b498d0016bd99ef47c26cb166ce
BLAKE2b-256 ea0269a6d672c3c719321b72190d253618fcc1ff9e791195aafb4e56dc9f8b4b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page