Calculating APY

Cycle Protocol
3 min readMay 28, 2021

--

Warning, math ahead!

The formula for calculating APY is

Where,
r is the annual interest rate, and
n is the number of times compounded annually

Easy to calculate if you have these values, but we have neither. What we do have is a collection of reinvest events where we know the reinvest time, t, and the amount of LP 1 share will equal after a reinvest.

For some vault, let’s take the last 2 reinvests, A and B. B is the more recent reinvest and A was the previous reinvest. We have:

We know that from reinvest A to B, the LP has grown by some percent, p:

Isolating p we have:

Now we consider the time, t, between reinvests:

If we assume reinvests continue to occur at this frequency, we can produce a value for n in the original APY equation by dividing the time in a year by this value:

Using the same assumption, we can say the percent increase, p, would occur n times in a year, giving us a value for r in the APY formula:

Plugging r into the APY formula and reducing a bit we have:

Then plugging in p and reducing:

Great! Now we know all three of these values and can compute an APY from two consecutive reinvests. This provides an APY based on actual results from recent strategy earning reinvests and rapid changes in the strategy performance would be quickly reflected. Since only the most recent reinvests are used, the APY result can fluctuate a bit based on the time lapse between calls. It will tend to land around the same value as the main bottleneck and determinant is the strategy income performance.

A keen eye would notice that we’ve actually derived the Compound Annual Growth Rate (CAGR) formula at this point. This could have been used as a starting point, although I think it’s helpful to breakdown the above for anyone who would be skeptical of it’s use.

Please remember to DYOR and understand this is not investment advice. The APY value for LP growth is based on short term performance and presented using an annual time frame. This does not imply any guaranteed growth in the AVAX or USD value of your position, impermanent loss risk is still present.

--

--

Cycle Protocol
Cycle Protocol

Written by Cycle Protocol

Yield optimizer with rewards on the Avalanche C-Chain

No responses yet