bt


Namebt JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/pmorissette/bt
SummaryA flexible backtesting framework for Python
upload_time2023-11-20 03:03:15
maintainer
docs_urlNone
authorPhilippe Morissette
requires_python>=3.8
licenseMIT
keywords python finance quant backtesting strategies algotrading algorithmic trading
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![](http://pmorissette.github.io/bt/_static/logo.png)

[![Build Status](https://github.com/pmorissette/bt/workflows/Build%20Status/badge.svg)](https://github.com/pmorissette/bt/actions/)
[![Codecov](https://codecov.io/gh/pmorissette/bt/branch/master/graph/badge.svg)](https://codecov.io/pmorissette/bt)
[![PyPI Version](https://img.shields.io/pypi/v/bt)](https://pypi.org/project/bt/)
[![PyPI License](https://img.shields.io/pypi/l/bt)](https://pypi.org/project/bt/)

# 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](http://pmorissette.github.io/bt/bt.html#bt.core.Algo). 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](https://github.com/pmorissette/ffn) - a financial function library for Python. Check it out!

## Features

* **Tree Structure**
    [The tree structure](http://pmorissette.github.io/bt/tree.html) facilitates the construction and composition of complex algorithmic trading
    strategies that are modular and re-usable. Furthermore, each tree [Node](http://pmorissette.github.io/bt/bt.html#bt.core.Node) has its own
    price index that can be used by Algos to determine a Node's allocation.

* **Algorithm Stacks**
    [Algos](http://pmorissette.github.io/bt/bt.html#bt.core.Algo) and [AlgoStacks](http://pmorissette.github.io/bt/bt.html#bt.core.AlgoStack) 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](http://pmorissette.github.io/bt/bt.html#bt.backtest.Result) 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](https://pypi.python.org/pypi/bt/)
using `pip`:

```bash
pip install bt
```


Since bt has many dependencies, we strongly recommend installing the [Anaconda Scientific Python
Distribution](https://store.continuum.io/cshop/anaconda/), 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.

## Recommended Setup

We believe the best environment to develop with bt is the [IPython Notebook](http://ipython.org/notebook.html).
From their homepage, the IPython Notebook is:

    "[...] a web-based interactive computational environment
    where you can combine code execution, text, mathematics, plots and rich
    media into a single document [...]"

This environment allows you to plot your charts in-line and also allows you to
easily add surrounding text with Markdown. You can easily create Notebooks that
you can share with colleagues and you can also save them as PDFs. If you are not
yet convinced, head over to their website.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pmorissette/bt",
    "name": "bt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "python finance quant backtesting strategies algotrading algorithmic trading",
    "author": "Philippe Morissette",
    "author_email": "morissette.philippe@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/62/2a/860db1f9580747e110523c018a4243ca4e007cc8d5e106fc5a89686ab33d/bt-1.0.0.tar.gz",
    "platform": null,
    "description": "![](http://pmorissette.github.io/bt/_static/logo.png)\n\n[![Build Status](https://github.com/pmorissette/bt/workflows/Build%20Status/badge.svg)](https://github.com/pmorissette/bt/actions/)\n[![Codecov](https://codecov.io/gh/pmorissette/bt/branch/master/graph/badge.svg)](https://codecov.io/pmorissette/bt)\n[![PyPI Version](https://img.shields.io/pypi/v/bt)](https://pypi.org/project/bt/)\n[![PyPI License](https://img.shields.io/pypi/l/bt)](https://pypi.org/project/bt/)\n\n# bt - Flexible Backtesting for Python\n\nbt is currently in alpha stage - if you find a bug, please submit an issue.\n\nRead the docs here: http://pmorissette.github.io/bt.\n\n## What is bt?\n\n**bt** is a flexible backtesting framework for Python used to test quantitative\ntrading strategies. **Backtesting** is the process of testing a strategy over a given\ndata set. This framework allows you to easily create strategies that mix and match\ndifferent [Algos](http://pmorissette.github.io/bt/bt.html#bt.core.Algo). It aims to foster the creation of easily testable, re-usable and\nflexible blocks of strategy logic to facilitate the rapid development of complex\ntrading strategies.\n\nThe goal: to save **quants** from re-inventing the wheel and let them focus on the\nimportant part of the job - strategy development.\n\n**bt** is coded in **Python** and joins a vibrant and rich ecosystem for data analysis.\nNumerous libraries exist for machine learning, signal processing and statistics and can be leveraged to avoid\nre-inventing the wheel - something that happens all too often when using other\nlanguages that don't have the same wealth of high-quality, open-source projects.\n\nbt is built atop [ffn](https://github.com/pmorissette/ffn) - a financial function library for Python. Check it out!\n\n## Features\n\n* **Tree Structure**\n    [The tree structure](http://pmorissette.github.io/bt/tree.html) facilitates the construction and composition of complex algorithmic trading\n    strategies that are modular and re-usable. Furthermore, each tree [Node](http://pmorissette.github.io/bt/bt.html#bt.core.Node) has its own\n    price index that can be used by Algos to determine a Node's allocation.\n\n* **Algorithm Stacks**\n    [Algos](http://pmorissette.github.io/bt/bt.html#bt.core.Algo) and [AlgoStacks](http://pmorissette.github.io/bt/bt.html#bt.core.AlgoStack) are\n    another core feature that facilitate the creation of modular and re-usable strategy\n    logic. Due to their modularity, these logic blocks are also easier to test -\n    an important step in building robust financial solutions.\n\n* **Charting and Reporting**\n    bt also provides many useful charting functions that help visualize backtest\n    results. We also plan to add more charts, tables and report formats in the future,\n    such as automatically generated PDF reports.\n\n* **Detailed Statistics**\n    Furthermore, bt calculates a bunch of stats relating to a backtest and offers a quick way to compare\n    these various statistics across many different backtests via [Results](http://pmorissette.github.io/bt/bt.html#bt.backtest.Result) display methods.\n\n\n## Roadmap\n\nFuture development efforts will focus on:\n\n* **Speed**\n    Due to the flexible nature of bt, a trade-off had to be made between\n    usability and performance. Usability will always be the priority, but we do\n    wish to enhance the performance as much as possible.\n\n* **Algos**\n    We will also be developing more algorithms as time goes on. We also\n    encourage anyone to contribute their own algos as well.\n\n* **Charting and Reporting**\n    This is another area we wish to constantly improve on\n    as reporting is an important aspect of the job. Charting and reporting also\n    facilitate finding bugs in strategy logic.\n\n## Installing bt\n\nThe easiest way to install `bt` is from the [Python Package Index](https://pypi.python.org/pypi/bt/)\nusing `pip`:\n\n```bash\npip install bt\n```\n\n\nSince bt has many dependencies, we strongly recommend installing the [Anaconda Scientific Python\nDistribution](https://store.continuum.io/cshop/anaconda/), especially on Windows. This distribution\ncomes with many of the required packages pre-installed, including pip. Once Anaconda is installed, the above\ncommand should complete the installation.\n\n## Recommended Setup\n\nWe believe the best environment to develop with bt is the [IPython Notebook](http://ipython.org/notebook.html).\nFrom their homepage, the IPython Notebook is:\n\n    \"[...] a web-based interactive computational environment\n    where you can combine code execution, text, mathematics, plots and rich\n    media into a single document [...]\"\n\nThis environment allows you to plot your charts in-line and also allows you to\neasily add surrounding text with Markdown. You can easily create Notebooks that\nyou can share with colleagues and you can also save them as PDFs. If you are not\nyet convinced, head over to their website.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A flexible backtesting framework for Python",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/pmorissette/bt"
    },
    "split_keywords": [
        "python",
        "finance",
        "quant",
        "backtesting",
        "strategies",
        "algotrading",
        "algorithmic",
        "trading"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a0b2b2052b11b46b896650e48f3aae5604beaae9c718db7efcc3b1a4d883bd8",
                "md5": "3af73fbb87e1decdfe57ea9216c299d4",
                "sha256": "63cab816d063a6df806731f3aa414135c4862dbeb73f61ad747f0d93280d6d28"
            },
            "downloads": -1,
            "filename": "bt-1.0.0-cp310-cp310-macosx_11_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "3af73fbb87e1decdfe57ea9216c299d4",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 264932,
            "upload_time": "2023-11-20T03:03:12",
            "upload_time_iso_8601": "2023-11-20T03:03:12.958754Z",
            "url": "https://files.pythonhosted.org/packages/1a/0b/2b2052b11b46b896650e48f3aae5604beaae9c718db7efcc3b1a4d883bd8/bt-1.0.0-cp310-cp310-macosx_11_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc2821408dd6441c1d0c3b5738cab0c0844b58d6171954d87e486d2b172aedab",
                "md5": "ef4d5bb132181598f6dc45c7d9d33833",
                "sha256": "a4e0b73f851fb77cab3e312b4f97979590125639ab18abf95af18deb34e2aa09"
            },
            "downloads": -1,
            "filename": "bt-1.0.0-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "ef4d5bb132181598f6dc45c7d9d33833",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 215489,
            "upload_time": "2023-11-20T03:04:45",
            "upload_time_iso_8601": "2023-11-20T03:04:45.172314Z",
            "url": "https://files.pythonhosted.org/packages/dc/28/21408dd6441c1d0c3b5738cab0c0844b58d6171954d87e486d2b172aedab/bt-1.0.0-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "390e2b918d8b866be7e2812f2d5f3a9a09e46389fb79b9caf49f74a1db31b272",
                "md5": "0b70117f05b1ef15add0bca9a30453df",
                "sha256": "b1cc96605f3bcd8fb2c6597818c0cb687d27ddc597f2a0c67c2b528dde5dd8cc"
            },
            "downloads": -1,
            "filename": "bt-1.0.0-cp311-cp311-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "0b70117f05b1ef15add0bca9a30453df",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 466999,
            "upload_time": "2023-11-20T03:03:54",
            "upload_time_iso_8601": "2023-11-20T03:03:54.949834Z",
            "url": "https://files.pythonhosted.org/packages/39/0e/2b918d8b866be7e2812f2d5f3a9a09e46389fb79b9caf49f74a1db31b272/bt-1.0.0-cp311-cp311-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5e41ba310c4c92adb702ccb52ec7046adaa188ba3bf17c277460f4514ac92d16",
                "md5": "626663cc1a35695b1b839899ca4b2034",
                "sha256": "754255272e25599b49d3d66851a3d08bf31ab914a8b80e3abc60d41cc6d5dfac"
            },
            "downloads": -1,
            "filename": "bt-1.0.0-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "626663cc1a35695b1b839899ca4b2034",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 216305,
            "upload_time": "2023-11-20T03:05:07",
            "upload_time_iso_8601": "2023-11-20T03:05:07.970701Z",
            "url": "https://files.pythonhosted.org/packages/5e/41/ba310c4c92adb702ccb52ec7046adaa188ba3bf17c277460f4514ac92d16/bt-1.0.0-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb30589707cc4cd1d8d5c5a64110c2f1886423961a79ce4af42d50f1523ae3e1",
                "md5": "ab6335f706e007e518e1d88dddb19d2d",
                "sha256": "29e5da2a5114e8436892801990b61dd2e28145ffd9aaa0d27777e110be242005"
            },
            "downloads": -1,
            "filename": "bt-1.0.0-cp38-cp38-macosx_11_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ab6335f706e007e518e1d88dddb19d2d",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 261653,
            "upload_time": "2023-11-20T03:05:07",
            "upload_time_iso_8601": "2023-11-20T03:05:07.270232Z",
            "url": "https://files.pythonhosted.org/packages/fb/30/589707cc4cd1d8d5c5a64110c2f1886423961a79ce4af42d50f1523ae3e1/bt-1.0.0-cp38-cp38-macosx_11_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "30bfb72284845dbd191da972ebf9d0387491d840064fdf535c1930c0cd913c2e",
                "md5": "af7648e0595e25fdc55a677eda26423e",
                "sha256": "d69682c34af72a81e5e3c1657e5a965d91f4a62c7189c8ee468cc95f89759a6f"
            },
            "downloads": -1,
            "filename": "bt-1.0.0-cp38-cp38-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "af7648e0595e25fdc55a677eda26423e",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 216977,
            "upload_time": "2023-11-20T03:03:17",
            "upload_time_iso_8601": "2023-11-20T03:03:17.155963Z",
            "url": "https://files.pythonhosted.org/packages/30/bf/b72284845dbd191da972ebf9d0387491d840064fdf535c1930c0cd913c2e/bt-1.0.0-cp38-cp38-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6cd132a141408025616d9669736f5f7e2454a5094c6b71ebfecb381e679c1808",
                "md5": "ea93f9ac53aec45510c62d9c1a02c469",
                "sha256": "37956a0eaf5c290d9ff8eb6a8aeb8d13a3a1a5f67925a45ab06f9c15d05d9a0f"
            },
            "downloads": -1,
            "filename": "bt-1.0.0-cp39-cp39-macosx_11_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ea93f9ac53aec45510c62d9c1a02c469",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 265090,
            "upload_time": "2023-11-20T03:05:34",
            "upload_time_iso_8601": "2023-11-20T03:05:34.666798Z",
            "url": "https://files.pythonhosted.org/packages/6c/d1/32a141408025616d9669736f5f7e2454a5094c6b71ebfecb381e679c1808/bt-1.0.0-cp39-cp39-macosx_11_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c2325e4359b96478d292e4414914d04b5f1ab507530fe5bb1918d3699b43ceff",
                "md5": "1896b67c9c6ae21477e5f3b9afe2d63b",
                "sha256": "623d11b6fcb81e6801c851b1c2afc4be42ca38a6b1939efe685feadd68e40861"
            },
            "downloads": -1,
            "filename": "bt-1.0.0-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "1896b67c9c6ae21477e5f3b9afe2d63b",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 215611,
            "upload_time": "2023-11-20T03:05:18",
            "upload_time_iso_8601": "2023-11-20T03:05:18.045011Z",
            "url": "https://files.pythonhosted.org/packages/c2/32/5e4359b96478d292e4414914d04b5f1ab507530fe5bb1918d3699b43ceff/bt-1.0.0-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "622a860db1f9580747e110523c018a4243ca4e007cc8d5e106fc5a89686ab33d",
                "md5": "2e7a9deaf6ce8c114c4b79a9ca0b76f4",
                "sha256": "94ba468ef470c3684a5e6e0eefd32edb85576ebb58ea6635b4d01b98be4eab15"
            },
            "downloads": -1,
            "filename": "bt-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2e7a9deaf6ce8c114c4b79a9ca0b76f4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 261986,
            "upload_time": "2023-11-20T03:03:15",
            "upload_time_iso_8601": "2023-11-20T03:03:15.557880Z",
            "url": "https://files.pythonhosted.org/packages/62/2a/860db1f9580747e110523c018a4243ca4e007cc8d5e106fc5a89686ab33d/bt-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-20 03:03:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pmorissette",
    "github_project": "bt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "bt"
}
        
Elapsed time: 0.14801s