diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e6f610cd..85ae101f0 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 1567483bb..032d13a64 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)) {