-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: add dynamic leverage #755
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #755 +/- ##
==========================================
- Coverage 43.53% 43.31% -0.23%
==========================================
Files 652 650 -2
Lines 21622 21570 -52
==========================================
- Hits 9414 9342 -72
- Misses 11090 11114 +24
+ Partials 1118 1114 -4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Tests are failing
- Also we need to add validations in tests to verify if dynamic lev is working fine
tests are updated already with different leverage for the same position , and also add collateral where lev = 1 |
@cryptokage1996
|
@cosmic-vagabond this will be fixed after #758 is merged refrence |
@cryptokage1996 ran another test and the the stablestake module data are part of the localnet snapshot now:
cc @amityadav0 |
@cryptokage1996 please have a look at the latest test result using the stablestake module data:
this time over, we can see the liabilities values are on, but for all the positions I tested on the |
if you look closely into the response for any position for eg lets pick a position with address elys1llll3p0zvykqhxtqhlfw4qu6p9llrxrgskhx0z (last position) if you see there position health
position health is calculated = exitAmountAfterFee / Liabilities So, position health is less than 1. which means Liabilities > exitAmountAfterFee. updated leverage = exitAmountAfterFee / (exitAmountAfterFee - liabilities) (exitAmountAfterFee - liabilities) is negative. if (exitAmountAfterFee - liabilities) is not positive we will set updated_leverage as zero. |
@cryptokage1996 you are right those are zombi positions, I wonder though why the bot did not liquidate them cc @amityadav0 @fenriz07 @cryptokage1996 I created a new position and queried it and now I can see a positive value for updated_leverage:
this is the command I used for created the position:
So I wonder why even though the position was created with a 5x leverage we ends up with a 6.35x leverage, there was no price movement at all and the position size is about 500usdc it should cause too much slippage neither. |
@cryptokage1996 ’s test results:
consolidation:
|
Enable users to adjust the leverage of an existing position when adding new collateral, allowing for flexibility in leverage management and improving user experience.
What has Changed?