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/

    Problem with Transactions analyzer

    Indicators/Strategies/Analyzers
    analyzer incorrect
    2
    5
    856
    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.
    • adrtod
      adrtod last edited by

      The Transactions analyzer does not allow to fully reproduce the cash, value series.
      It stores only non-zeros accumulated positions at the end of each bar.
      See analyzers/transactions.py lines 97-98
      It can be a problem when e.g. there are two opposite transactions (size s and -s) during the same bar at two different prices.
      In this case, the resulting position is null but there are commisions and PnL generated, which are not reported in the transactions analysis.

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

        @adrtod said in Problem with Transactions analyzer:

        The resulting position is null but there are commisions and PnL

        To start with, the Transactions analyzer does report neither commissions nor PnL.

        May you be talking about something else?

        1 Reply Last reply Reply Quote 0
        • adrtod
          adrtod last edited by adrtod

          I was expecting that two opposite size transactions during the same bar would be reported in the analysis (instead of nothing).

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

            The analyzer, as it is, was simply meant to ease the integration with pyfolio. Feel free to extend its functionality if you are issuing multiple counteracting orders during a single bar.

            1 Reply Last reply Reply Quote 0
            • adrtod
              adrtod last edited by

              I see. Thanks @backtrader for the answer and for the amazing work!

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