Bokeh Integration - Interactive Webbrowser Plotting
vbs last edited by
since I have discovered backtrader several weeks ago I am quite amazed by its capabilities and by its code quality. I still felt it would be nice to have better plotting integrated into backtrader.
In my opinion
Bokeh(https://bokeh.pydata.org/en/latest/docs/gallery.html) is an awesome plotting library for Python. So I gave it a try to have backtrader make use of it. It turned out that it was not very hard thanks to backtrader's great flexibility and its modularized nature.
I also tried to integrade
Plotlybut it actually became pretty slow when using larger amounts of data.
I have implemented several of backtrader's internal plotting options but still alot is missing. Also it will need alot more optimizations to make it polished.
This is how it currently looks like:
Usage in code is currently as simple as this which will open up a web browser:
b = Bokeh(style='bar') cerebro.plot(b)
Please view this for the interactive charting:
(Download and open in your web browser)
If you guys are interested then I will package, write some documentation and and post it here.
rob7429 last edited by
Wow - that's pretty sweet!
The interactivity of these plots are awesome.
ab_trader last edited by
Thats really cool! I was thinking to write plotter for
Bokehbut ended up with conceptual layout and didn't move forward a lot. Could you post the code on the
github? I might be able to add something.
vbs last edited by
What would be the preferred way to package this? Currently the code is meant to include some plotting classes for backtrader. So currently I am thinking about two options:
create a seperate package, e.g.
backtrader_plotting. This would reflect the intent to be a package which provides general plotting extensions for backtrader. I am especially unsure if @backtrader would be fine with the name since it is very close to the original
backtradername and people could think it is an official package or in any way related to the official repository. I do not want to offend anyone.
another option would be to try to get it into
backtrader_contrib. But it seems the idea of the
contribrepo did not really take off so far as it still has no commits. Also as I don't really know the background of the split, I am unsure if I understand its real intent. Also I am still hoping and begging that @backtrader will not abandon this great project :)
ThatBlokeDave last edited by
Great work! I am also a fan of Bokeh too...
My 2 cents would be to try
backtrader_contribfirst. Once the first commits start coming in, I am sure others will follow. I think half of the reason it has not taken off so far is that @backtrader has not been so active as of late. We had a couple of projects (like @Richard-O-Regan's basic trade stats and @Ed-Bartosh's CCXT integration) which would be ideal additions to the