APR calculation

Pool APR

The pool's Annual Percentage Rate (APR) is influenced by both the trading volume and the pool's rewards. The calculation is based on the average trading volume over the past 24 hours.

apr = ((feeUsd * 365) / tvlUsd) * 100 + rewardAPR

Position APR

We use the getPositionAPR method in the SDK to calculate the position apr

Examples

const poolId = '0xb32fb8ec0b447a833066496bd7251d3a2ee57a0a97c54bf4cc945a986235582a';
const pool = await turbosSdk.pool.getPool(poolId);
const positionId =
  '0xb7efa54832e000dcb8879e586f74cec55623105920c96f5f1ebe78a60f9cbd3b';
const position = await turbosSdk.nft.getPositionFields(positionId);
turbosSdk.nft.getPositionAPR({
  poolId,
  tickLower: turbosSdk.math.bitsToNumber(position.tick_lower_index.fields.bits),
  tickUpper: turbosSdk.math.bitsToNumber(position.tick_upper_index.fields.bits),
  fees24h: '100000000',
  getPrice: async (coinType) => {
    return await getPriceFromApi(coinType);
  },
})

Last updated