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

Bigz/fix calculate net user pnl #589

Closed
wants to merge 17 commits into from
Closed

Conversation

0xbigz
Copy link
Member

@0xbigz 0xbigz commented Aug 22, 2023

No description provided.

0xbigz and others added 17 commits August 21, 2023 19:22
* start test

* improve lp_delta_quote

* improve per_lp_delta_quote

* init per_lp_base

* add rebase functions (wip)

* rm err msg

* add controller rebase to proper locations

* add rebase cargo test

* (wip) k out of wack

* fix rebase test and add more asserts

* format fix

* incorp basic example to typescript tests

* fix rebase math in position.rs (wip)

* wip continue

* working baseAssetAmountWithUnsettledLp

* mvp encapsulation of update_lp_market_position

* src/user.ts: add perLpBase to empty position

* remove logs

* simplify base unit logic more

* add get_per_lp_base_unit

* simplify per_lp_fee and add numbers to test

* properly set per_lp_base for lp_share=0 in mint_lp_shares (and add sdk/test)

* incorp feedback / format

* tests/liquidityProvider.ts: work with sdk change

* admin.rs: add constraint on per_lp_base range

* add apply_lp_rebase_to_perp_position to simulate_settled_lp_position

* use get_per_lp_base_unit consistently (wip sdk test for negative lp base)

* cut excess return values in calculate_lp_delta

* fix getPerpPositionWithLPSettle with negative perLpBase delta

---------

Co-authored-by: Chris Heaney <[email protected]>
* sdk: add debug for bulk account loader handleAccountCallbacks

* log callbacks individually
@0xbigz
Copy link
Member Author

0xbigz commented Mar 22, 2024

addressed in #912

@0xbigz 0xbigz closed this Mar 22, 2024
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

Successfully merging this pull request may close these issues.

None yet

4 participants