Package: backtrader-bokeh
Backtrader_BokehYou can visit our wiki homepage for more information:EN|中文Backtrader_Bokehto add extended plotting capabilities toBacktraderusingBokehbased on the awesomebacktrader_plottingandbtplotting. Besides this, a lot of issues are fixed and new functionality is added. See the list below for differences.What is different:Basic:No need for custom backtraderDifferent naming / structureDifferent data generation which allows to generate data for different data sources.
This is useful when replaying or resampling data, for example to remove gaps.Different filtering of plot objectsSupport for replay dataEvery figure has its own ColumnDataSource, so the live client can patch without
having issues with nan values, every figure is updated individuallyDisplay of plots looks more like backtrader plotting (order, heights, etc.)Allows to generate custom columns, which don't have to be hardcoded. This is being used to generate
color for candles, varea values, etc.Possibility to fill gaps of higher timeframes with dataPlotting:Datas, Indicators, Observer and Volume have own aspect ratios, which can be configured in live client
or schemeDifferent datafeed's plot sytle can be customize separatelyOnly one axis for volume will be added when using multiple data sources on one figureVolume axis position is configureable in scheme, by default it is being plotted on the right sideLinked Crosshair across all figuresfill_gt, fill_lt, fill supportPlot objects can be filtered by one or more datanames or by plot groupCustom plot group, which can be configured in app or in live client by providing all
plotids in a comma-seperated list or by selecting the parts of the plot to displayTabs:Default tabs can be completely removedNew log panel to also include logging informationCan be extended with custom tabs (for example order execution with live client, custom analysis, etc.)Live plotting:Navigation in live client (Pause, Backward, Forward)Live plotting is done using an analyzer, so there is no need to use custom backtraderLive plotting data update works in a single thread and is done by a DataHandlerData update is being done every n seconds, which is configureableFeaturesInteractive plotsSupport keyboard operationInteractivebacktraderoptimization result browser (only supported for single-strategy runs)Highly configurableDifferent skinnable themesIn addition to OHLC, additional datafeed line can be plotedEasy to useBug fixedSome examples, more detail in CHANGELOG.mdMany bugs in Backtrader that have not been still fixed, Backtrader_Bokeh fixed those through Monkey PatchBecause of optbrowser address and port assignment problem, if port 80 is occupied, the web page will not be opened in the optimization mode.* live mode is the same wayVery imortant, fixed the legend can't be displayed in the observer or indicators's figuerAnd more...Python >= 3.6 is required.How to useJust giveLive Modeexample, aboutNormal ModeandOptstrategy Modepls refer towiki-en|wiki-中文Add to cerebro as an analyzer(Live Mode):frombacktrader_bokehimportbt......cerebro=bt.Cerebro()cerebro.addstrategy(MyStrategy)cerebro.adddata(LiveDataStream())# Note! Data is must Live Datacerebro.addanalyzer(bt.analyzers.Live,force_plot_legend=True,autostart=True)cerebro.run()# cerebro.plot() # do not run this line unless your data is not real-timeIf you need to change the default port or share the plotting to public:cerebro.addanalyzer(bt.analyzers.Live,address="localhost",port=8889)JupyterIn Jupyter you can plut to a single browser tab with iplot=False:frombacktrader_bokehimportbtplot=bt.Bokeh()cerebro.plot(plot,iplot=False)You may encounters TypeError:<class '__main__.YourStrategyClass'>is a built-in class error.To remove the source code tab use:frombacktrader_bokehimportbtplot=bt.Bokeh()plot.tabs.remove(bt.tabs.SourceTab)cerebro.plot(plot,iplot=False)Demoshttps://iniself.github.io/backtrader_bokeh/Contact usTelegram Channel:Aui_SayDiscord Server:Aui and FriendsInstallationpip install backtrader_bokehorpip install git+https://github.com/iniself/backtrader_bokehSponsoringIf you want to support the development of backtrader_bokeh, consider to support this project.ETH: 0x0275779f70179748C6fCe1Fe5D7638DfA7e3F986