backtrader
==========
.. image:: https://img.shields.io/pypi/v/backtrader.svg
:alt: PyPi Version
:scale: 100%
:target: https://pypi.python.org/pypi/backtrader/
.. .. image:: https://img.shields.io/pypi/dm/backtrader.svg
:alt: PyPi Monthly Donwloads
:scale: 100%
:target: https://pypi.python.org/pypi/backtrader/
.. image:: https://img.shields.io/pypi/l/backtrader.svg
:alt: License
:scale: 100%
:target: https://github.com/backtrader/backtrader/blob/master/LICENSE
.. image:: https://travis-ci.org/backtrader/backtrader.png?branch=master
:alt: Travis-ci Build Status
:scale: 100%
:target: https://travis-ci.org/backtrader/backtrader
.. image:: https://img.shields.io/pypi/pyversions/backtrader.svg
:alt: Python versions
:scale: 100%
:target: https://pypi.python.org/pypi/backtrader/
**Yahoo API Note**:
[2018-11-16] After some testing it would seem that data downloads can be
again relied upon over the web interface (or API ``v7``)
**Tickets**
The ticket system is (was, actually) more often than not abused to ask for
advice about samples.
For **feedback/questions/...** use the `Community <https://community.backtrader.com>`_
Here a snippet of a Simple Moving Average CrossOver. It can be done in several
different ways. Use the docs (and examples) Luke!
::
from datetime import datetime
import backtrader as bt
class SmaCross(bt.SignalStrategy):
def __init__(self):
sma1, sma2 = bt.ind.SMA(period=10), bt.ind.SMA(period=30)
crossover = bt.ind.CrossOver(sma1, sma2)
self.signal_add(bt.SIGNAL_LONG, crossover)
cerebro = bt.Cerebro()
cerebro.addstrategy(SmaCross)
data0 = bt.feeds.YahooFinanceData(dataname='MSFT', fromdate=datetime(2011, 1, 1),
todate=datetime(2012, 12, 31))
cerebro.adddata(data0)
cerebro.run()
cerebro.plot()
Including a full featured chart. Give it a try! This is included in the samples
as ``sigsmacross/sigsmacross2.py``. Along it is ``sigsmacross.py`` which can be
parametrized from the command line.
Features:
=========
Live Trading and backtesting platform written in Python.
- Live Data Feed and Trading with
- Interactive Brokers (needs ``IbPy`` and benefits greatly from an
installed ``pytz``)
- *Visual Chart* (needs a fork of ``comtypes`` until a pull request is
integrated in the release and benefits from ``pytz``)
- *Oanda* (needs ``oandapy``) (REST API Only - v20 did not support
streaming when implemented)
- Data feeds from csv/files, online sources or from *pandas* and *blaze*
- Filters for datas, like breaking a daily bar into chunks to simulate
intraday or working with Renko bricks
- Multiple data feeds and multiple strategies supported
- Multiple timeframes at once
- Integrated Resampling and Replaying
- Step by Step backtesting or at once (except in the evaluation of the Strategy)
- Integrated battery of indicators
- *TA-Lib* indicator support (needs python *ta-lib* / check the docs)
- Easy development of custom indicators
- Analyzers (for example: TimeReturn, Sharpe Ratio, SQN) and ``pyfolio``
integration (**deprecated**)
- Flexible definition of commission schemes
- Integrated broker simulation with *Market*, *Close*, *Limit*, *Stop*,
*StopLimit*, *StopTrail*, *StopTrailLimit*and *OCO* orders, bracket order,
slippage, volume filling strategies and continuous cash adjustmet for
future-like instruments
- Sizers for automated staking
- Cheat-on-Close and Cheat-on-Open modes
- Schedulers
- Trading Calendars
- Plotting (requires matplotlib)
Documentation
=============
The blog:
- `Blog <http://www.backtrader.com/blog>`_
Read the full documentation at:
- `Documentation <http://www.backtrader.com/docu>`_
List of built-in Indicators (122)
- `Indicators Reference <http://www.backtrader.com/docu/indautoref.html>`_
Python 2/3 Support
==================
- Python >= ``3.2``
- It also works with ``pypy`` and ``pypy3`` (no plotting - ``matplotlib`` is
not supported under *pypy*)
Installation
============
``backtrader`` is self-contained with no external dependencies (except if you
want to plot)
From *pypi*:
- ``pip install backtrader``
- ``pip install backtrader[plotting]``
If ``matplotlib`` is not installed and you wish to do some plotting
.. note:: The minimum matplotlib version is ``1.4.1``
An example for *IB* Data Feeds/Trading:
- ``IbPy`` doesn't seem to be in PyPi. Do either::
pip install git+https://github.com/blampe/IbPy.git
or (if ``git`` is not available in your system)::
pip install https://github.com/blampe/IbPy/archive/master.zip
For other functionalities like: ``Visual Chart``, ``Oanda``, ``TA-Lib``, check
the dependencies in the documentation.
From source:
- Place the *backtrader* directory found in the sources inside your project
Version numbering
=================
X.Y.Z.I
- X: Major version number. Should stay stable unless something big is changed
like an overhaul to use ``numpy``
- Y: Minor version number. To be changed upon adding a complete new feature or
(god forbids) an incompatible API change.
- Z: Revision version number. To be changed for documentation updates, small
changes, small bug fixes
- I: Number of Indicators already built into the platform
Raw data
{
"_id": null,
"home_page": "https://github.com/paperswithbacktest/backtrader_paperswithbacktest",
"name": "backtrader-paperswithbacktest",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "trading, development",
"author": "Daniel Rodriguez",
"author_email": "danjrod@gmail.com",
"download_url": "https://github.com/paperswithbacktest/backtrader_paperswithbacktest/tarball/1.9.78.123",
"platform": null,
"description": "backtrader\n==========\n\n.. image:: https://img.shields.io/pypi/v/backtrader.svg\n :alt: PyPi Version\n :scale: 100%\n :target: https://pypi.python.org/pypi/backtrader/\n\n.. .. image:: https://img.shields.io/pypi/dm/backtrader.svg\n :alt: PyPi Monthly Donwloads\n :scale: 100%\n :target: https://pypi.python.org/pypi/backtrader/\n\n.. image:: https://img.shields.io/pypi/l/backtrader.svg\n :alt: License\n :scale: 100%\n :target: https://github.com/backtrader/backtrader/blob/master/LICENSE\n.. image:: https://travis-ci.org/backtrader/backtrader.png?branch=master\n :alt: Travis-ci Build Status\n :scale: 100%\n :target: https://travis-ci.org/backtrader/backtrader\n.. image:: https://img.shields.io/pypi/pyversions/backtrader.svg\n :alt: Python versions\n :scale: 100%\n :target: https://pypi.python.org/pypi/backtrader/\n\n**Yahoo API Note**:\n\n [2018-11-16] After some testing it would seem that data downloads can be\n again relied upon over the web interface (or API ``v7``)\n\n**Tickets**\n\n The ticket system is (was, actually) more often than not abused to ask for\n advice about samples.\n\nFor **feedback/questions/...** use the `Community <https://community.backtrader.com>`_\n\nHere a snippet of a Simple Moving Average CrossOver. It can be done in several\ndifferent ways. Use the docs (and examples) Luke!\n::\n\n from datetime import datetime\n import backtrader as bt\n\n class SmaCross(bt.SignalStrategy):\n def __init__(self):\n sma1, sma2 = bt.ind.SMA(period=10), bt.ind.SMA(period=30)\n crossover = bt.ind.CrossOver(sma1, sma2)\n self.signal_add(bt.SIGNAL_LONG, crossover)\n\n cerebro = bt.Cerebro()\n cerebro.addstrategy(SmaCross)\n\n data0 = bt.feeds.YahooFinanceData(dataname='MSFT', fromdate=datetime(2011, 1, 1),\n todate=datetime(2012, 12, 31))\n cerebro.adddata(data0)\n\n cerebro.run()\n cerebro.plot()\n\nIncluding a full featured chart. Give it a try! This is included in the samples\nas ``sigsmacross/sigsmacross2.py``. Along it is ``sigsmacross.py`` which can be\nparametrized from the command line.\n\nFeatures:\n=========\n\nLive Trading and backtesting platform written in Python.\n\n - Live Data Feed and Trading with\n\n - Interactive Brokers (needs ``IbPy`` and benefits greatly from an\n installed ``pytz``)\n - *Visual Chart* (needs a fork of ``comtypes`` until a pull request is\n integrated in the release and benefits from ``pytz``)\n - *Oanda* (needs ``oandapy``) (REST API Only - v20 did not support\n streaming when implemented)\n\n - Data feeds from csv/files, online sources or from *pandas* and *blaze*\n - Filters for datas, like breaking a daily bar into chunks to simulate\n intraday or working with Renko bricks\n - Multiple data feeds and multiple strategies supported\n - Multiple timeframes at once\n - Integrated Resampling and Replaying\n - Step by Step backtesting or at once (except in the evaluation of the Strategy)\n - Integrated battery of indicators\n - *TA-Lib* indicator support (needs python *ta-lib* / check the docs)\n - Easy development of custom indicators\n - Analyzers (for example: TimeReturn, Sharpe Ratio, SQN) and ``pyfolio``\n integration (**deprecated**)\n - Flexible definition of commission schemes\n - Integrated broker simulation with *Market*, *Close*, *Limit*, *Stop*,\n *StopLimit*, *StopTrail*, *StopTrailLimit*and *OCO* orders, bracket order,\n slippage, volume filling strategies and continuous cash adjustmet for\n future-like instruments\n - Sizers for automated staking\n - Cheat-on-Close and Cheat-on-Open modes\n - Schedulers\n - Trading Calendars\n - Plotting (requires matplotlib)\n\nDocumentation\n=============\n\nThe blog:\n\n - `Blog <http://www.backtrader.com/blog>`_\n\nRead the full documentation at:\n\n - `Documentation <http://www.backtrader.com/docu>`_\n\nList of built-in Indicators (122)\n\n - `Indicators Reference <http://www.backtrader.com/docu/indautoref.html>`_\n\nPython 2/3 Support\n==================\n\n - Python >= ``3.2``\n\n - It also works with ``pypy`` and ``pypy3`` (no plotting - ``matplotlib`` is\n not supported under *pypy*)\n\nInstallation\n============\n\n``backtrader`` is self-contained with no external dependencies (except if you\nwant to plot)\n\nFrom *pypi*:\n\n - ``pip install backtrader``\n\n - ``pip install backtrader[plotting]``\n\n If ``matplotlib`` is not installed and you wish to do some plotting\n\n.. note:: The minimum matplotlib version is ``1.4.1``\n\nAn example for *IB* Data Feeds/Trading:\n\n - ``IbPy`` doesn't seem to be in PyPi. Do either::\n\n pip install git+https://github.com/blampe/IbPy.git\n\n or (if ``git`` is not available in your system)::\n\n pip install https://github.com/blampe/IbPy/archive/master.zip\n\nFor other functionalities like: ``Visual Chart``, ``Oanda``, ``TA-Lib``, check\nthe dependencies in the documentation.\n\nFrom source:\n\n - Place the *backtrader* directory found in the sources inside your project\n\nVersion numbering\n=================\n\nX.Y.Z.I\n\n - X: Major version number. Should stay stable unless something big is changed\n like an overhaul to use ``numpy``\n - Y: Minor version number. To be changed upon adding a complete new feature or\n (god forbids) an incompatible API change.\n - Z: Revision version number. To be changed for documentation updates, small\n changes, small bug fixes\n - I: Number of Indicators already built into the platform\n",
"bugtrack_url": null,
"license": "GPLv3+",
"summary": "BackTesting Engine",
"version": "1.9.78.123",
"project_urls": {
"Download": "https://github.com/paperswithbacktest/backtrader_paperswithbacktest/tarball/1.9.78.123",
"Homepage": "https://github.com/paperswithbacktest/backtrader_paperswithbacktest"
},
"split_keywords": [
"trading",
" development"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2f4900b5f307d70bd03dd24b31f80fa7bfa2f6f5a1f818ab239bfba966b46136",
"md5": "d23d915559d0e49a466318fc5810dd35",
"sha256": "a46c241b90e1eb6933ea97a27f269d30fae5717e57df06c5ff0a9e51da00c5c1"
},
"downloads": -1,
"filename": "backtrader_paperswithbacktest-1.9.78.123-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "d23d915559d0e49a466318fc5810dd35",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 821994,
"upload_time": "2024-05-18T12:12:11",
"upload_time_iso_8601": "2024-05-18T12:12:11.701497Z",
"url": "https://files.pythonhosted.org/packages/2f/49/00b5f307d70bd03dd24b31f80fa7bfa2f6f5a1f818ab239bfba966b46136/backtrader_paperswithbacktest-1.9.78.123-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-18 12:12:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "paperswithbacktest",
"github_project": "backtrader_paperswithbacktest",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "backtrader-paperswithbacktest"
}