For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Bokeh Integration - Interactive Webbrowser Plotting

  • Hello gentlemen,

    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 ( 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 Plotly but 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')

    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.

  • Wow - that's pretty sweet!
    The interactivity of these plots are awesome.
    Nice work.

  • Thats really cool! I was thinking to write plotter for bt using Bokeh but 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.

  • 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 backtrader name 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 contrib repo 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 :)

  • @vbs

    Great work! I am also a fan of Bokeh too...

    My 2 cents would be to try backtrader_contrib first. 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 backtrader_contrib repo.

Log in to reply

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.