Skip to content

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

Bugfix/fix performance chart calculation (#1267)

Thomas Kaul263f6b32f2de
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0774d9f870..2d60fa9063 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the language localization for German (`de`)
+### Fixed
+
+- Respected the end date in the performance chart calculation
+
### Todo
Set `NODE_ENV: production` as in [docker-compose.yml](https://github.com/ghostfolio/ghostfolio/blob/main/docker/docker-compose.yml)
diff --git a/apps/api/src/app/portfolio/portfolio-calculator.ts b/apps/api/src/app/portfolio/portfolio-calculator.ts
index 9905eadb28..6b53e57452 100644
--- a/apps/api/src/app/portfolio/portfolio-calculator.ts
+++ b/apps/api/src/app/portfolio/portfolio-calculator.ts
@@ -967,6 +967,10 @@ export class PortfolioCalculator {
feesAtStartDate = fees;
grossPerformanceAtStartDate = grossPerformance;
}
+
+ if (i === indexOfEndOrder) {
+ break;
+ }
}
timeWeightedGrossPerformancePercentage =