APY Calculation
APY shown in frontend is calculated using the following formula.

Auto-compound APY

First we deduct fee from APR:
NetAPR=RewardAPR(1fee)Net APR = Reward APR * (1 - fee)
Second, we calculate into APY. We use 365 (daily compound):
NetAPY=(1+NetAPR/365)3651Net APY = (1 + Net APR / 365)^{365} - 1
Then, we include trade APR.
AutocompoundAPY=(1+NetAPY)(1+TradeAPR)1Autocompound APY = (1 + Net APY) * (1 + Trade APR) - 1
NOTE: For Trade APR, we use multiplication here because in auto-compound we grow LP and LP is multiplication of trading APR.
For example:
Net APY = 20%, Trade APR = 10%
Year 0: LP = 100 and 1 LP = 1 Token + 1 UST (Total value is 200 UST)
Year 1: LP = 120 and 1 LP = 1.1 Token + 1.1 UST (Total value is 264 UST)
Year 0-1 Profit = 64 UST
We can apply compound APY formula to get the same result:
Compound APY = (1 + Net APY 20%) * (1 + Trade APR 10%) - 1 = 32%
Investment 200 UST * 32% = 64 UST

Full example for auto-compound APY calculation

Reward APR = 87.57%, Fee = 5%, Trade APR = 4.59%
Net APR = 0.8757 * (1 - 0.08) = 0.831915
Net APY = (1 + 0.831915 / 365) ^ 365 - 1 = 1.295541
Auto-compound APY = (1 + 1.295541) * (1 + 0.0459) - 1 + 0.0348 = 140.09%

Data source and cache interval

The APRs are obtained from the API of each protocol such as Astroport's API. The consolidated data will be provided via Spectrum's API and cached for 5-10 minutes while each protocol might have various cache intervals depending on their update frequency.
Copy link
On this page
Auto-compound APY
Data source and cache interval