![](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": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"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/8e/fd/a9285a2d2224fd62ae796fec035f1663b37eb0a4243dee5ddea360584b69/bt-1.0.1.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.1",
"project_urls": {
"Homepage": "https://github.com/pmorissette/bt"
},
"split_keywords": [
"python",
"finance",
"quant",
"backtesting",
"strategies",
"algotrading",
"algorithmic",
"trading"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8efda9285a2d2224fd62ae796fec035f1663b37eb0a4243dee5ddea360584b69",
"md5": "7063e1f4e47b33702cf3b7a8abe89382",
"sha256": "5ac3d184c3e287a9f831708cee381b576d7e74eabd5050ddff2daaeed5059680"
},
"downloads": -1,
"filename": "bt-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "7063e1f4e47b33702cf3b7a8abe89382",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 227626,
"upload_time": "2024-06-24T00:49:38",
"upload_time_iso_8601": "2024-06-24T00:49:38.296813Z",
"url": "https://files.pythonhosted.org/packages/8e/fd/a9285a2d2224fd62ae796fec035f1663b37eb0a4243dee5ddea360584b69/bt-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-24 00:49:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pmorissette",
"github_project": "bt",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "bt"
}