From 36220cf8a82c53d77a76bd21e096f552d12d427c Mon Sep 17 00:00:00 2001 From: Oumar Fall Date: Fri, 29 Nov 2024 15:48:32 +0100 Subject: [PATCH] fix(blue-api-sdk): fix market apys computation --- packages/blue-api-sdk/src/converter.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/blue-api-sdk/src/converter.ts b/packages/blue-api-sdk/src/converter.ts index 77d22e8a..fbd41cae 100644 --- a/packages/blue-api-sdk/src/converter.ts +++ b/packages/blue-api-sdk/src/converter.ts @@ -196,8 +196,9 @@ export class BlueSdkConverter { const rateAtTarget = // rateAtUTarget is not typed nullable, but it will be as soon as a non-compatible IRM is enabled. dto.state.rateAtUTarget != null - ? // API rate at targed is annualized, while the Market rateAtTarget is per second. - this.options.parseNumber(dto.state.rateAtUTarget, 18) / + ? // API rate at target is compounded over the year, while the Market rateAtTarget is per second. + //TODO use rateAtTarget directly per second + this.options.parseNumber(Math.log1p(dto.state.rateAtUTarget), 18) / Time.s.from.y(1n) : undefined;