From 72fbc62a5318e2080b9341fbd078ef5589e062ba Mon Sep 17 00:00:00 2001 From: iamoskvin Date: Sun, 2 Jun 2024 12:51:33 +0300 Subject: [PATCH] switch to week apr --- src/components/PairList/index.js | 4 ++-- src/contexts/PairData.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/PairList/index.js b/src/components/PairList/index.js index 7fcb4d0..13afd36 100644 --- a/src/components/PairList/index.js +++ b/src/components/PairList/index.js @@ -203,8 +203,8 @@ function PairList({ const fees = formattedNum(pairData.oneDayFeesUSD, true) - const feeRatio24H = pairData.oneDayFeesUSD / pairData.totalValueLockedUSD - // const apy = ((1 + feeRatio24H) ** 365 - 1) * 100 + // const feeRatio24H = pairData.oneDayFeesUSD / pairData.totalValueLockedUSD + const feeRatio24H = pairData.oneWeekFeesUSD / 7 / pairData.totalValueLockedUSD const apr = feeRatio24H * 365 * 100 const cleanedApr = isNaN(apr) || !isFinite(apr) ? 0 : apr const displayApr = formattedPercent(cleanedApr, true) diff --git a/src/contexts/PairData.js b/src/contexts/PairData.js index 1f5b870..0d4bcbb 100644 --- a/src/contexts/PairData.js +++ b/src/contexts/PairData.js @@ -181,6 +181,7 @@ function parseData(data, oneDayData, twoDayData, oneWeekData) { // set fees properties data.oneDayFeesUSD = parseFloat(oneDayFeesUSD); data.feesChangeUSD = feesChangeUSD; + data.oneWeekFeesUSD = parseFloat(oneWeekData?.feesUSD) || 0 // set liquidity properties data.liquidityChangeUSD = getPercentChange(oneDayData.totalValueLockedUSD, oneDayData.totalValueLockedUSDFirst)