Navigation

    Backtrader Community

    • Register
    • 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/

    Getting the correct portfolio value before closing position when using mult

    General Code/Help
    1
    2
    39
    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.
    • ?
      A Former User last edited by

      When multiplier is used in backtrader, the multipliers multiplied return is only added once the position is closed. It leads to charts like this:

      4f1fa970-3b6b-49b5-8140-5ddcc3c5e320-image.png

      self.broker.getvalue() plotted better:
      2b0da1e4-c5b7-403b-8f65-b7dca7676d70-image.png

      This rise didn't actually happen like at once like shown in the plot, but the multipliers profit is only added at positon close. In my exchange while trading pepetual swaps, the multipliers value is updated real time, not just on position close. This has lead to unrealism while doing the portfolio analysis. How can i achieve the same behavior in backtrader where the portfolio value is updated real time along with multiplier and not just on position close?

      ? 1 Reply Last reply Reply Quote 0
      • ?
        A Former User @Guest last edited by

        I have solved my problem. Mult acts like this, turns out what i want is leverage.

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