squeeth-monorepo icon indicating copy to clipboard operation
squeeth-monorepo copied to clipboard

Fix unstable/inflated unrealised pnl issues

Open EstherSeyi opened this issue 2 years ago • 11 comments

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

EstherSeyi avatar Apr 13 '22 13:04 EstherSeyi

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

vercel[bot] avatar Apr 13 '22 13:04 vercel[bot]

@EstherSeyi How do I test these and are there any issues created for this?

KMKoushik avatar Apr 13 '22 23:04 KMKoushik

@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

EstherSeyi avatar Apr 14 '22 06:04 EstherSeyi

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)

vercel[bot] avatar Apr 17 '22 19:04 vercel[bot]

Don't understand the reason behind removing subscription, can you please explain it?

KMKoushik avatar Apr 20 '22 12:04 KMKoushik

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 avatar Apr 20 '22 12:04 EstherSeyi

@EstherSeyi Tests are failing, can you check it?

KMKoushik avatar Apr 26 '22 00:04 KMKoushik

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

EstherSeyi avatar Apr 27 '22 06:04 EstherSeyi

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 Screen Shot 2022-04-27 at 8 58 40 pm

KMKoushik avatar Apr 27 '22 10:04 KMKoushik

@EstherSeyi Still getting the same issue. Seems to be working in ropsten but not in mainnet. I pinged you with the wallet address

KMKoushik avatar May 03 '22 22:05 KMKoushik

Need to be merged after we fix positions completely

KMKoushik avatar May 06 '22 07:05 KMKoushik