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

Bug in bt.analyzers.Transactions next method

  • In the line:
    self.rets[self.data0.datetime.datetime()] = entries
    datetime is accessed through self.data0.datetime. It is causing problems when you develop strategies with many datas from which some start earlier than others and you start trading from the moment when first data becomes available.
    I think that easiest solution is to just change the line to:
    self.rets[self.strategy.datetime.datetime()] = entries

  • administrators

    That analyzer was developed ad-hoc for a specific purpose a long time ago and then added (or dumped) to the sources. Back then the synchronization relied on different methods, but as you point out using the main clock in the strategy would be the most appropriate path.

Log in to reply