How v3 APR is calculated
In V3 Liquidity and Farms, with the new non-fungible liquidity and customizable price range ability. Each LP position will have its own LP fee and CAKE farming APR.
The total APR is combined by the LP fee APR and CAKE reward APR
Theoretically speaking, given a price range and liquidity user about to add, we can estimate the expected future 7 days fee as following
- : Fee amount accrued in the user specified price range in last 7 days
- : Current liquidity in the user specified price range
- : Liquidity user want to add to the price range
, we use the historical trading volume data, fee tier and historical price data to estimate the price in range
- : Fee tier
- : Total trading volume of last 7 days
- : Duration, measured in seconds, of prices staying within the price range in the past 7 days
- : 7 days measured in seconds
The total reward cake per second in MC v3 using upkeep and can be derived by
cakePerSecond = lastestPeriodCakePerSecond / 1e12 / 1e18
In each pool, we can use
poolInfoto get the
poolInfo.allocPoint / totalAllocPoint
Global APR calculated using the total amount of active & staked liquidity with the pool CAKE reward emissions.
APR (global) = (cakePerSecond * 31536000) / (totalAllocPoint / pool.allocPoint) * 100 * cakeUSD / totalStakedLiquidityUSD
totalStakedLiquidityUSDrepresents the current pool active staked liquidity in USD, composing by all the position ticks in range staked in MasterChef v3.
APRs for individual positions may vary depend on their price range settings.
- : CAKE reward earn USD per year in pool
- : Total USD value in position
- : Position liquidity
- : Total staking liquidity which tracked by LMPool