From 263f6b32f2defb169f5ed553c67ba1225b3d6594 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 17 Sep 2022 08:33:04 +0200 Subject: [PATCH] Bugfix/fix performance chart calculation (#1267) * Respect end date in performance chart calculation Co-Authored-By: gizmodus <11334553+gizmodus@users.noreply.github.com> * Update changelog Co-Authored-By: gizmodus <11334553+gizmodus@users.noreply.github.com> --- CHANGELOG.md | 4 ++++ apps/api/src/app/portfolio/portfolio-calculator.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0774d9f87..2d60fa906 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 9905eadb2..6b53e5745 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 =