backtrader内置的可视化布局比较拥挤。 我们今天重点来说说backtrader_plotting这个扩展包,它是基于bokeh,这个包我们之前单独介绍过。pandas_bokeh:投资量化平台可视化的利器 使用pip直接安装:pip install backtrader_plotting。 github上的开源地址: 网页链接 01 基础使用 from backtrader_plotting import Bokeh from backtrader_...
b = Bokeh(style='line', scheme=Tradimo(),plotconfig=plotconfig) self.cerebro.plot(b) backtrader_plotting不只是使用bokeh替换matplotlib,它还做了大量的工作,把analyzer和observer的结果直接呈现出来,这省了我们不少事。 另外就是bokeh的动态性,以及网页的可扩展布局优势。 这里也充分体现了backtrader生态的优势。
backtrader内置的绘图功能基于命令 cerebro.plot(),输出的是无交互性的图。有几个人提供了基于web的绘图功能扩展包。 最早的是backtrader_plotting ,然后是btplotting,btplotting修正和扩展了backtrader_plotting的功能,再然后是backtrader_bokeh,它是在前面两个包的基础上加了一些小扩展。backtrader_bokeh允许显示自定义的...
为backtrader添加扩展绘图功能的backtrader ( )。 目前唯一可用的后端是Bokeh ( )。 特征 互动图 实时交易支持(需要自定义backtrader - 请参阅 Wiki 以获取更多信息) 数据回放支持 交互式backtrader优化结果浏览器(仅支持单策略运行) 可自定义的选项卡面板 ...
importdatetimeimportbacktraderasbtfrombacktrader_plottingimportBokehclassTestStrategy(bt.Strategy):params=( ('buydate',21), ('holdtime',6), )defnext(self):iflen(self.data)==self.p.buydate:self.buy(self.datas[0],size=None)iflen(self.data)==self.p.buydate+self.p.holdtime:self.sell(self...
import datetime import backtrader as bt from backtrader_plotting import Bokeh class TestStrategy(bt.Strategy): params = ( ('buydate', 21), ('holdtime', 6), ) def next(self): if len(self.data) == self.p.buydate: self.buy(self.datas[0], size=None) if len(self.data) == self....
GPL-3.0 license btplotting Library to add extended plotting capabilities tobacktrader(https://www.backtrader.com/) using bokeh. btplotting is based on the awesomebacktrader_plotting(https://github.com/verybadsoldier/backtrader_plotting) btplottingis a complete rework ofbacktrader_plottingwith the live...
Library to add extended plotting capabilities tobacktrader(https://www.backtrader.com/) using bokeh. btplotting is based on the awesomebacktrader_plotting(https://github.com/verybadsoldier/backtrader_plotting) btplottingis a complete rework ofbacktrader_plottingwith the live client in focus. Besides ...