From ac2f47697b0ad569e1caadf6a8ebc1aabc020208 Mon Sep 17 00:00:00 2001 From: syuhei176 Date: Mon, 6 Nov 2023 18:49:43 +0900 Subject: [PATCH] fix apr calculation --- src/adaptors/predy-v5/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/adaptors/predy-v5/index.js b/src/adaptors/predy-v5/index.js index 618dd7a89d..ced0d20073 100755 --- a/src/adaptors/predy-v5/index.js +++ b/src/adaptors/predy-v5/index.js @@ -179,14 +179,14 @@ const lendingApys = async () => { function getApr(latest, start) { const latestPrice = new BigNumber(latest.closePrice) const startPrice = new BigNumber(start.closePrice) - const apr = latestPrice.times(1000000).div(startPrice).minus(1000000) + const apr = latestPrice.times(1000000).div(startPrice).toNumber() - 1000000 const span = Number(latest.closeTimestamp) - Number(start.closeTimestamp) if (span === 0) { return 0 } - return (apr.toNumber() / 10000) * (60 * 60 * 24 * 365) / span + return (apr / 10000) * (60 * 60 * 24 * 365) / span }