APR calculation
Pool APR
apr = ((feeUsd * 365) / tvlUsd) * 100 + rewardAPRPosition APR
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