squeeth-monorepo
squeeth-monorepo copied to clipboard
Fix unstable/inflated unrealised pnl issues
Task:
Description
- Replaces vault manager subscription with polling to ensure that vault data is always updated.
- Replaces swaps data with swaps atom in computeSwaps provider to ensure that squeethAmount is always updated for pnl calculation.
- Removes swaps query subscription as it didn't seem to work and was causing bug of swaps being empty array sometimes.
- Adds unit tests for unrealized pnl calculations. Run test with:
yarn test pnl
Fixes # (issue) #350
Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Document update
How Has This Been Tested
You can test by seeing if you experience loading issues or incorrect pnl. see this doc for the unrealized pnl formulas.
Checklist
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings
- [ ] Added video recordings if it is a UI change
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/opynfinance/continuouscall/CaqYwbassRq9mAi9uPVQhivDN6eY
✅ Preview: https://continuouscall-git-fe-unrealized-pnl-issues-opynfinance.vercel.app
@EstherSeyi How do I test these and are there any issues created for this?
@EstherSeyi How do I test these and are there any issues created for this?
Yes I just created an issue. I think you can just watch and calculate the pnl to see that it's correct. Doc with formulas
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
continuouscall | ✅ Ready (Inspect) | Visit Preview | May 4, 2022 at 0:28AM (UTC) |
Don't understand the reason behind removing subscription, can you please explain it?
Don't understand the reason behind removing subscription, can you please explain it?
For subscriptions, we are dependent on the server to update the data, and sometimes that doesn't happen as expected which causes pnl bugs
@EstherSeyi Tests are failing, can you check it?
continuouscall-git-fe-unrealized-pnl-issues-opynfinance.vercel.app
My tx history is gone
Similarly my long position is also not shown
@KMKoushik was there any error on your console
continuouscall-git-fe-unrealized-pnl-issues-opynfinance.vercel.app
My tx history is gone
Similarly my long position is also not shown
@KMKoushik was there any error on your console
Nothing new @EstherSeyi
@EstherSeyi Still getting the same issue. Seems to be working in ropsten but not in mainnet. I pinged you with the wallet address
Need to be merged after we fix positions completely