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.
This one shows details of orders, note the Entry/Exit reason/name
This one shows the options and nice chart with signal description
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
analyzerswhich provide some of this detail as well.
Actually both observers and analyzers can be useful to output results. Observers for series of data, analyzers for value in the moment.
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
SharpeRatioyou can plug it in and then retrieve it. If you don't need it, there is no need to calculate it.
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
Analyzerssupport also instantiating
Indicatorobjects and other
Analyzerobjects in either
__start__, to make it easy to create your own
Analyzer(by simply putting together some analyzers)
An example using children
Analyzerinstances 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.