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

Return from position resize seems wrong #2404

Closed
bonomat opened this issue Apr 11, 2024 · 0 comments · Fixed by #2412
Closed

Return from position resize seems wrong #2404

bonomat opened this issue Apr 11, 2024 · 0 comments · Fixed by #2412
Assignees
Labels
bug Something isn't working

Comments

@bonomat
Copy link
Contributor

bonomat commented Apr 11, 2024

Start Situation:

  • 100 long
  • Average entry price $100,000
  • Leverage 2
  • Margin: 50,000 sats

Price increases to $110,000

  • go 50 short (resulting in being 50 long)
  • At the price of $110,000
  • Leverage 2

Should behavior:

  • We are selling 50 contracts at the price of $110,000
  • The value of this would be = 50/(110,000 * 2) = 22,727 sats
  • Fee should be 136 sats
  • The average entry price should remain: $100,000
  • The remaining margin in the position should be
    • = initial_margin - returning_margin - fee
    • = 50,000 - 22,727 - 136
    • = 27,137

Is behavior

  • We are returning 27,137 into the wallet and have 27,273 left
image image image
@bonomat bonomat added the bug Something isn't working label Apr 11, 2024
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 a pull request may close this issue.

2 participants