Skip to content

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

Bugfix/fix gaps in portfolio performance charts (#3311)

Thomas Kaul551b83a6e346
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2e6f610cd8..85ae101f0f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Upgraded `angular` from version `17.3.3` to `17.3.5`
- Upgraded `Nx` from version `18.2.3` to `18.3.3`
+### Fixed
+
+- Fixed gaps in the portfolio performance charts by considering `BUY` and `SELL` activities
+
## 2.73.0 - 2024-04-17
### Added
diff --git a/apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts b/apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
index 1567483bbb..032d13a641 100644
--- a/apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
+++ b/apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
@@ -334,8 +334,10 @@ export class TWRPortfolioCalculator extends PortfolioCalculator {
if (isChartMode) {
const datesWithOrders = {};
- for (const order of orders) {
- datesWithOrders[order.date] = true;
+ for (const { date, type } of orders) {
+ if (['BUY', 'SELL'].includes(type)) {
+ datesWithOrders[date] = true;
+ }
}
while (isBefore(day, end)) {