Strategies APY
Last updated
Last updated
Each strategy will give a different APY (Annual Percentage Yield) depending on what the strategy does — for example lending, swapping, farming or even leverage lending, etc...
To calculate APY, you might need some extra data, like:
The value of the harvested token (the token the strategy earns),
The APY of other protocols the strategy interacts with,
The emission rate of the harvested token (how fast it’s being distributed),
And any other rewards or fees involved.
But instead of tracking all of that manually, the makes things easier. It emits a HarvestEvent
every time the strategy runs its logic (in the harvest()
function). This event includes a very important value: the Price Per Share (price_per_share
or PPS).
Every time someone deposits into a strategy, they receive shares. As the strategy earns yield, the value of each share increases.
The Price Per Share (PPS) tells you how much one share is worth. You don’t need to track individual profits — just track the PPS over time.
To calculate the APY, we compare the PPS now with the PPS in the past (e.g., 1 day, 7 days, or 30 days ago).
Let:
PPS now: the latest price per share
PPS then: the price per share at a past time
Δt: number of days between the two points
This gives the percentage growth over that time period.
Here, 365.2425
is the average number of days in a year (to account for leap years).
PPS now = 1.10
PPS 30 days ago = 1.00
Days = 30
This means if the strategy keeps performing the same way, the estimated yearly return is 113.8%.