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

TimeDrawDown Time Frames

  • I'm working with hourly data for BTC, which trades 24/7. If I use the TimeDrawDown analyzer but want to look at this by day or by month, will backtrader automatically include 24 hours in a day and ~726 (30.25*24) in a month? My initial assumption was yes, but then I noticed in the returns analyzer there is a tann parameter and the 252 days for a year example wouldn't be the right way to approach a 24/7 crypto market. Thanks!

  • The TimeDrawDown analyzer is built off TimeFrameAnalyzerBase starting at line 289. Have a look at that code, perhaps you can get some clues there about how time is being handled and create your own custom analyzer overwriting or modifying I would imagine def _get_dt_cmpkey(self, dt): line 361.

Log in to reply