Browse Source

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

* Fix issue in annualized performance calculation

* Update changelog
pull/4846/head
Kenrick Tandrian 4 weeks ago
committed by GitHub
parent
commit
e8f185e484
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 10
      libs/common/src/lib/calculation-helper.ts

1
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

10
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);

Loading…
Cancel
Save