balancednetwork / balanced-network-info

ℹī¸ Balanced network analytics.
https://stats.balanced.network
MIT License
0 stars 0 forks source link

feat: add baln staking apy and update pool info #83

Closed hetfly closed 2 years ago

vercel[bot] commented 2 years ago

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/balanced-dao/balanced-network-info/4dUQZoE5yL5grRQ7d8ogZrKNJHQg
✅ Preview: https://balanced-network-info-git-feat-display-baln-1d140e-balanced-dao.vercel.app

BennyOptions commented 2 years ago

How to calculate:

($$ value of fees distributed over the last month 12) / (Number of Staked BALN $$ price of BALN)

Screen Shot 2022-01-03 at 11 42 42 PM Screen Shot 2022-01-03 at 11 44 55 PM Screen Shot 2022-01-03 at 11 44 36 PM
BennyOptions commented 2 years ago

For Fee APYs, here is the calculation for everything except sICX/ICX. For sICX / ICX, instead of multiplying by 50%, please multiply by 70%

$$ value of fees 365 50% / $$ value of liquidity.... (Red box 365 50% / Green Box)

Screen Shot 2022-01-03 at 11 49 24 PM
hetfly commented 2 years ago

@BennyOptions thanks for the help! Please review the numbers.

BennyOptions commented 2 years ago

@hetfly I just realized that the calculation I gave for Fee APY for pools is only based on the last 24 hours, not on a trailing 30 day average.

@hetfly @pranav925 is it possible to pull Fees (30 day)? If so, let's change the Fee APY calculation to use Fees (30d) 12 instead of Fee (24h) 365.

Screen Shot 2022-01-04 at 3 37 59 PM
BennyOptions commented 2 years ago

For 30d of fees

https://balanced.geometry.io/api/v1/stats/dex-pool-stats-30d

hetfly commented 2 years ago

updated, ready for review

parrot9design commented 2 years ago

This is looking great, thanks @hetfly! Aside from the minor content change suggested, I only noticed 2 things:

Screen Shot 2022-01-18 at 9 27 02 AM

BennyOptions commented 2 years ago

Blocked, waiting for continuous rewards upgrade

BennyOptions commented 2 years ago

@hetfly I was just comparing the APYs from this PR to production and noticed they are quite different. Can you explore that? It's the BALN APY. They should both match.

This PR

Screen Shot 2022-02-22 at 6 56 48 PM

Current production page

Screen Shot 2022-02-22 at 6 58 04 PM
hetfly commented 2 years ago

@BennyOptions APY calculations are identical, difference was in current rewards settings. Merged master into this branch and all looks good now.

parrot9design commented 2 years ago

@hetfly Let's resolve the conflicts in this branch so we can have it ready to merge alongside the continuous rewards update.

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗ī¸Ž

Name Status Preview Updated
balanced-network-info ✅ Ready (Inspect) Visit Preview Jun 21, 2022 at 9:52AM (UTC)
hetfly commented 2 years ago

@parrot9design this PR is ready to be reviewed.

BTW shouldn't we change the abbreviations to APR (BALN staking as well as pools)? APY reflects compounding during the year, our numbers don't. The BALN APY is something I'd like to go through in Stats v2

cc @BennyOptions

parrot9design commented 2 years ago

Ah, yes I think you're correct re: APY vs APR. I've added suggestions to make the change easier. Other than that, this should be good to merge alongside continuous rewards.

EDIT: After talking on the frontend call, I've removed the APR suggestions. The meanings for APY/APR seem to vary widely, so am thinking we'll replace the term with Yield, Reward rate, or something similar. Will likely address that in a separate update, though.

parrot9design commented 2 years ago

@hetfly I noticed that the BALN staking APY doesn't have a loading animation. Is it possible to add one?

The Exchange section currently isn't loading any data. Does that need to be updated to account for the new java contracts?

hetfly commented 2 years ago

@parrot9design both issues sorted out

parrot9design commented 2 years ago

Looks good, thanks @hetfly!

BennyOptions commented 2 years ago

Math looks good, no longer blocked by contract. @hetfly @parrot9design looks good to merge

BennyOptions commented 2 years ago

Might be worth noting here that the calculation doesn't include impermanent losses, with a link to impermanent loss explained? @parrot9design

https://finematics.com/impermanent-loss-explained/#:~:text=In%20essence%2C%20impermanent%20loss%20is,providing%20liquidity%20in%20that%20asset.

parrot9design commented 2 years ago

Good call. @hetfly, let's add this line to the end as a label:

Impermanent loss is not factored in.

Screen Shot 2022-06-21 at 5 14 50 PM

If it's possible to keep the tooltip content up when the mouse hovers over it, we could link off for more info, like this:

Impermanent loss is not factored in.

But that may be too much hassle, so it's also fine to ship without it.