Skip to content
  • Author Owner
    Edited by Bigboss
  • Author Owner

    // 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}) + '%';
     }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment