gym-mtsim
gym-mtsim copied to clipboard
A question about calculate balance
In my opinion, balance mean to cash. So when open a new order, the balance should minus cash used in orders. But in _create_hedged_order function, not update balance. It's a bug or I have misunderstand?
seq | Id | Symbol | Type | Volume | Entry Time | Entry Price | Exit Time | Exit Price | Profit | Margin | Fee | Closed |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 2 | USDJPY | Sell | 2.0 | 2021-09-01 00:17:52+00:00 | 110.02500 | 2021-09-06 00:17:52+00:00 | 109.71200 | 552.355257 | 2000.000000 | 0.0100 | False |
1 | 1 | GBPCAD | Buy | 1.0 | 2021-08-30 00:17:52+00:00 | 1.73389 | 2021-09-06 00:17:52+00:00 | 1.73626 | 165.225928 | 1375.480933 | 0.0003 | False |
And an other question. For the table above from Readme.md. How the profit and margin calcuate out? I calcuate it but not same.
In my opinion, balance mean to cash. So when open a new order, the balance should minus cash used in orders. But in _create_hedged_order function, not update balance. It's a bug or I have misunderstand?
You are referring to equity. According to Metatrader, equity is calculated as balance+profit.
And an other question. For the table above from Readme.md. How the profit and margin calcuate out? I calcuate it but not same.
The implementations can be found here and here. There references might also help as well.