Package: backtrader-lucidinvestor
backtradercreditsoriginal author: Daniel Rodriguez (danjrod@gmail.com)
original unmaintained github:https://github.com/mementum/backtraderalternative unmaintained github:https://github.com/backtrader2/backtraderTicketsThe ticket system is available atLucidInvestor’s public gitlab instance.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
assigsmacross/sigsmacross2.py. Along it issigsmacross.pywhich can be
parametrized from the command line.Installationbacktraderis self-contained with no external dependencies (except if you
want to plot)Frompypi:pip installbacktrader-lucidinvestorpip install backtrader[plotting]Ifmatplotlibis not installed and you wish to do some plottingNoteThe minimum matplotlib version is1.4.1An example forIBData Feeds/Trading:IbPypip installIbPy-lucidinvestorFor other functionalities like:Visual Chart,Oanda,TA-Lib, check
the dependencies in the documentation.From source:Place thebacktraderdirectory found in the sources inside your projectPython 2/3 SupportPython >=3.2It also works withpypyandpypy3(no plotting -matplotlibis
not supported underpypy)FeaturesLive Trading and backtesting platform written in Python.Live Data Feed and Trading withInteractive Brokers (needsIbPyand benefits greatly from an
installedpytz)Visual Chart(needs a fork ofcomtypesuntil a pull request is
integrated in the release and benefits frompytz)Oanda(needsoandapy) (REST API Only - v20 did not support
streaming when implemented)Data feeds from csv/files, online sources or frompandasandblazeFilters for datas, like breaking a daily bar into chunks to simulate
intraday or working with Renko bricksMultiple data feeds and multiple strategies supportedMultiple timeframes at onceIntegrated Resampling and ReplayingStep by Step backtesting or at once (except in the evaluation of the Strategy)Integrated battery of indicatorsTA-Libindicator support (needs pythonta-lib/ check the docs)Easy development of custom indicatorsAnalyzers (for example: TimeReturn, Sharpe Ratio, SQN) andpyfoliointegration (deprecated)Flexible definition of commission schemesIntegrated broker simulation withMarket,Close,Limit,Stop,StopLimit,StopTrail,StopTrailLimit*and *OCOorders, bracket order,
slippage, volume filling strategies and continuous cash adjustmet for
future-like instrumentsSizers for automated stakingCheat-on-Close and Cheat-on-Open modesSchedulersTrading CalendarsPlotting (requires matplotlib)DocumentationThe blog:BlogRead the full documentation at:DocumentationList of built-in Indicators (122)Indicators ReferenceVersion numberingX.Y.Z.IX: Major version number. Should stay stable unless something big is changed
like an overhaul to usenumpyY: 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 fixesI: Number of Indicators already built into the platformmajor Branchesmaster- Merge from Develop. QA for full integration happens here.
Contains the last tested/verified global code integration.release- Checkout from Master. Branch based on release & tags. Bug fix in checkout branches,
and merge with others.develop- Checkout from Master / Pull.Req from Develop. Develop new features, docs …bug- checkout from master and pull.req. OR checkout from release branch and pull.req/Masterfeatures-  checkout Develop.Branch naming conventionsshall follow that of [GroupName/Info](http://stackoverflow.com/questions/273695/git-branch-naming-best-practices):Usegrouping namesat the beginning of your branch names.Define and use shortlead tokensto differentiate branches in a way that is meaningful to your workflow.Use slashes to separate parts of your branch names.Do not use bare numbers as leading parts.Avoid long descriptive names for long-lived branches.Grouping NamesShort and well-defined group names (used to tell you to which part of your workflow each branch belongs):code-block/ textrcrelease candidatenewmajor new feature, modulefeataddition of incremental feature/enhancementbugBug fixjunkThrowaway branch created to experimenttestdocdocumentation (readme, code comment)Commit messagesStandard prefixes to start a commit message:code-block:: textBLDchange related to buildBUGbug fixDEPdeprecate something, or remove a deprecated objectDEVdevelopment tool or utilityDOCdocumentationENHenhancementMAINTmaintenance commit (refactoring, typos, etc)REVrevert an earlier commitSTYstyle fix (whitespace, PEP8, flake8, etc)TSTaddition or modification of testsRELrelated to releasingPERFperformance enhancementsSome commit style guidelines:Commit lines should be no longer than72 characters. The first line of the commit should include one of the above prefixes. There should be an empty line between the commit subject and the body of the commit. In general, the message should be in the imperative tense. Best practice is to include not only what the change is, but why the change was made.Repo Structuregit remote add bt2-originalhttps://github.com/backtrader2/backtrader.gitgit fetch bt2-original master
git branch –set-upstream-to=bt2-original/master
git pull
git push origin -u bt2/original/mastergit remote -vbt-originalhttps://github.com/mementum/backtrader.git(fetch)
bt-originalhttps://github.com/mementum/backtrader.git(push)
bt2-originalhttps://github.com/backtrader2/backtrader.git(fetch)
bt2-originalhttps://github.com/backtrader2/backtrader.git(push)
mementumhttps://github.com/mementum/backtrader.git(fetch)
mementumhttps://github.com/mementum/backtrader.git(push)
origingit@gitlab.com:algorithmic-trading-library/backtrader.git (fetch)
origingit@gitlab.com:algorithmic-trading-library/backtrader.git (push)git branch -vvbt/original/develop  fca15d9 [origin/bt/original/develop] Release 1.9.75.123
bt/original/master   0fa63ef [origin/bt/original/master] Merge pull request #418 from Larry-u/patch-1
bt2/original/develop ef00a78 [origin/bt2/original/develop] Merge branch ‘master’ ofhttps://github.com/backtrader2/backtraderinto bt2/original/master
bt2/original/master  ef00a78 [origin/bt2/original/master] Merge branch ‘master’ ofhttps://github.com/backtrader2/backtraderinto bt2/original/master
develop              9f843b0 MAINT: making things cleaner for testing bid/ask.
development          9f843b0 [origin/development: gone] MAINT: making things cleaner for testing bid/ask.
feat/ib/bidask       dcb4c1a Release 1.9.74.123
feat/ib/rt-bidask    7b366cd [origin/feat/ib/rt-bidask] FEAT: bid/ask stream. on and off. tested live.
master               9f843b0 [origin/master] MAINT: making things cleaner for testing bid/ask.Fetching all remote branchesfor abranch in $(git branch -a | grep -v HEAD | grep remotes | sed “s/remotes/origin///g”); do git checkout $abranch ; done