From ed29c2ceab548741743577fbff1831be885b5eb3 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:35:45 +0100 Subject: [PATCH] Bugfix/fix issue in annualized performance calculation (#6310) * Fix issue in annualized performance calculation: Handle case where growthFactor is Infinity * Update changelog --- CHANGELOG.md | 4 ++++ libs/common/src/lib/calculation-helper.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edbfa5460..696ed2dbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgraded `twitter-api-v2` from version `1.27.0` to `1.29.0` +### Fixed + +- Fixed an issue in the annualized performance calculation + ## 2.237.0 - 2026-02-08 ### Changed diff --git a/libs/common/src/lib/calculation-helper.ts b/libs/common/src/lib/calculation-helper.ts index d67384a30..76b38f9b2 100644 --- a/libs/common/src/lib/calculation-helper.ts +++ b/libs/common/src/lib/calculation-helper.ts @@ -9,7 +9,7 @@ import { subDays, subYears } from 'date-fns'; -import { isNumber } from 'lodash'; +import { isFinite, isNumber } from 'lodash'; import { resetHours } from './helper'; import { DateRange } from './types'; @@ -28,7 +28,7 @@ export function getAnnualizedPerformancePercent({ exponent ); - if (!isNaN(growthFactor)) { + if (isFinite(growthFactor)) { return new Big(growthFactor).minus(1); } }