diff --git a/apps/api/src/app/core/portfolio-calculator.ts b/apps/api/src/app/core/portfolio-calculator.ts index 0af578c30..a90d4a057 100644 --- a/apps/api/src/app/core/portfolio-calculator.ts +++ b/apps/api/src/app/core/portfolio-calculator.ts @@ -418,13 +418,18 @@ export class PortfolioCalculator { hasErrors = true; } } + + if (!completeInitialValue.eq(0)) { + grossPerformancePercentage = + grossPerformancePercentage.div(completeInitialValue); + } + return { currentValue, grossPerformance, + grossPerformancePercentage, hasErrors, - totalInvestment, - grossPerformancePercentage: - grossPerformancePercentage.div(completeInitialValue) + totalInvestment }; }