-
-
// APY = (1 + LP vs HODL % / (total days / 7 day per week)) ^ 52 -1
calculateAPY(params): string { const dayCount = params.data.days; if (dayCount < 7) { return 'N/A'; } const percentageNumber = parseFloat(params.data.lpvshodl); const numberOfWeek = dayCount / 7 ; const periodicRatePercent = percentageNumber / numberOfWeek; const periodicRate = periodicRatePercent / 100; console.log(periodicRate + ' ' + periodicRatePercent); const apy = ((Math.pow((periodicRate + 1), 52)) - 1) * 100; console.log(periodicRate + ' ' + periodicRatePercent + ' ' + apy.toFixed(2) + '%'); return apy.toLocaleString('en-us', {minimumFractionDigits: 2}) + '%'; }
Please register or sign in to comment