Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Bug in bt.analyzers.Transactions next method

    Indicators/Strategies/Analyzers
    2
    2
    746
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mpskowron last edited by

      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

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors