Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/fix issue in annualized performance calculation (#4840)

Kenrick Tandriane8f185e484c0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e443f44e8b..706edd8650 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed an issue where the import button was not correctly enabled in the import activities dialog
+- Fixed an issue in the annualized performance calculation
## 2.166.0 - 2025-06-05
diff --git a/libs/common/src/lib/calculation-helper.ts b/libs/common/src/lib/calculation-helper.ts
index 4292f2383c..d67384a309 100644
--- a/libs/common/src/lib/calculation-helper.ts
+++ b/libs/common/src/lib/calculation-helper.ts
@@ -23,10 +23,14 @@ export function getAnnualizedPerformancePercent({
}): Big {
if (isNumber(daysInMarket) && daysInMarket > 0) {
const exponent = new Big(365).div(daysInMarket).toNumber();
+ const growthFactor = Math.pow(
+ netPerformancePercentage.plus(1).toNumber(),
+ exponent
+ );
- return new Big(
- Math.pow(netPerformancePercentage.plus(1).toNumber(), exponent)
- ).minus(1);
+ if (!isNaN(growthFactor)) {
+ return new Big(growthFactor).minus(1);
+ }
}
return new Big(0);