Custom data resolution

By default, Magmatic provides only a small number of data resolution options. However, it's possible to achieve almost any resolution. For example, if you need lending rates with 5 day resolution, you'd first request daily rates from the API (with resolution = 1d), and then calculate the average of every 5 data points.

AMM liquidity providing APY

You earn trading fees by providing liquidity to AMM protocols. Protocols often also incentivize LPs by offering them tokens. Note that you might also want to account for impermanent loss.
To calculate trading fees APY, you'd divide trading fees generated by total liquidity of that pool.
To calculate LM incentives APY, you'd first need to get dollar value of token incentives for the given amount by multiplying token amount and price. Then, you need to divide that value by total liquidity of the pool.
The final APY will be the sum of trading fee and incentives yield.
Remember to annualize yield based on the selected timespan. For fresh yield opportunities it's better to use shorter timeframe (e.g. a few days), while for more "traditional" yield programs you can use longer period (e.g. a month).
APYAMM=FeesTVLpool+AmountPriceTVLpool,annualizedAPY_{AMM} = \frac{Fees}{TVL_{pool}} + \frac{Amount * Price}{TVL_{pool}}, annualized
Last modified 1yr ago
Copy link
On this page
Custom data resolution
AMM liquidity providing APY