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/

    How does Backtrader calculate PnL in currency trading

    General Code/Help
    2
    2
    523
    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.
    • luxiaolei
      luxiaolei last edited by luxiaolei

      How does Backtrader handles PnL calculation in currency trading? For example, When I close a position in USD/CAD, I am PnL in CAD units, In order to let the observers(cash, value, etc) make sense, I need to convert all PnL to my home currency which is USD. I have searched the docs, but didn't find any solution to this.

      My question is quite obvious, I think I must have misunderstood something. Any helps would greatly appreciated.

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

        It doesn't. One would need a constant source of exchange rate values and understanding that you are trading different currencies.

        But yes, you can: what you need is to define your own commission scheme, which is actually in charge of calculating the profit and loss.

        For example: Docs - Extending Comissions

        There are some other chapters in the docs about commission schemes.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
        $(document).ready(function () { app.coldLoad(); }); }