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

fix: account balance calculation #514

Merged

Conversation

habibalkhabbaz
Copy link
Contributor

@habibalkhabbaz habibalkhabbaz commented Sep 27, 2022

Description

When we use updateAccountInfo to update the account balances on actions like buy order or sell order, it causes a race condition with the WebSocket because of manually subtracting and adding values.

To solve this, I replaced updateAccountInfo with getAccountFromAPI on buy order, sell order, and manual orders
Also, I replaced getAccountInfo with getAccountFromAPI to avoid the race condition too.

Related Issue

#512

Motivation and Context

How Has This Been Tested?

Tests provided

Screenshots (if appropriate):

@chrisleekr chrisleekr added the bug Something isn't working label Sep 27, 2022
@chrisleekr chrisleekr linked an issue Sep 27, 2022 that may be closed by this pull request
@chrisleekr
Copy link
Owner

Amazing @habibalkhabbaz

@chrisleekr chrisleekr merged commit bb79bad into chrisleekr:master Sep 27, 2022
@habibalkhabbaz habibalkhabbaz deleted the fix/account-balances-calculation branch October 7, 2022 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing sell orders because quantity doubles
2 participants