Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question about calculate balance #45

Open
ruifeng96150 opened this issue Dec 13, 2023 · 3 comments
Open

A question about calculate balance #45

ruifeng96150 opened this issue Dec 13, 2023 · 3 comments

Comments

@ruifeng96150
Copy link

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?

@ruifeng96150
Copy link
Author

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.

@AminHP
Copy link
Owner

AminHP commented Dec 18, 2023

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.

@AminHP
Copy link
Owner

AminHP commented Dec 18, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants