More Features in Cerebro.run()



  • Hi, I tried searching for a consolidated summary after executing cerebro.run(), but couldn't find one.
    The idea is to have a method to get some standard performance results of a strategy backtest
    may be like this res= cerebro.run(); res.summary()

    The idea is from a tool in market called ninja trader (screenshot below), however I like backtrader more for it's ease in coding strategies as compared to NT.

    But the output of NT is worth exploring and I think it might be a good idea to add some of the features.

    0_1484057300554_upload-d210d5c0-4ef5-4e2c-b84b-394e0926929e

    This one shows details of orders, note the Entry/Exit reason/name
    0_1484057399195_upload-c2ef120d-83dd-4757-b4ab-6e12885d4b85

    This one shows the options and nice chart with signal description
    0_1484057472152_upload-21193df6-ea5c-46cd-9211-be644fc2519f



  • You will likely get other more detailed responses here but as it stands, backtrader does return a results object from the .run(). The observers can then run against this information that is provided by the .run(). The task would be to write some of these other observers. The architecture is setup quite nicely to allow this modularity and analysis.



  • I actually may have also misspoke here but there is also the concept of analyzers which provide some of this detail as well.

    https://www.backtrader.com/docu/analyzers/analyzers.html



  • Actually both observers and analyzers can be useful to output results. Observers for series of data, analyzers for value in the moment.


  • administrators

    @Usct As pointed out by @ab_trader and @randyt, the collection of the information is down to the Analyzer hierarchy.

    The difference with the aforementioned NinjaTrader (without having used the platform) as presented above is that backtrader is more like a construction kit.

    You decide which things you plug in. If you want the SharpeRatio you can plug it in and then retrieve it. If you don't need it, there is no need to calculate it.

    A TradeAnalyzer (for the Total # of trades from above) and you get it.

    You can even print out the results (or store them in a file) if you also plug a Writer (Documentation). The implementation is rather generic, but nothing forbids having a specialized implementation which produces for example HTML.

    Analyzers support also instantiating Indicator objects and other Analyzer objects in either __init__ or __start__, to make it easy to create your own Analyzer (by simply putting together some analyzers)

    An example using children Analyzer instances is the PyFolio Analyzer



  • Thanks for the feedback.
    I tried Analyzer and Writer and it's really good.
    Somehow the lot of good features are not easy to find on the docs page.


Log in to reply
 

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