How does Backtrader calculate PnL in currency trading
-
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.
-
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.