Browse Source

Fix error with division by zero

pull/253/head
Thomas 4 years ago
parent
commit
5893572648
  1. 11
      apps/api/src/app/core/portfolio-calculator.ts

11
apps/api/src/app/core/portfolio-calculator.ts

@ -418,13 +418,18 @@ export class PortfolioCalculator {
hasErrors = true; hasErrors = true;
} }
} }
if (!completeInitialValue.eq(0)) {
grossPerformancePercentage =
grossPerformancePercentage.div(completeInitialValue);
}
return { return {
currentValue, currentValue,
grossPerformance, grossPerformance,
grossPerformancePercentage,
hasErrors, hasErrors,
totalInvestment, totalInvestment
grossPerformancePercentage:
grossPerformancePercentage.div(completeInitialValue)
}; };
} }

Loading…
Cancel
Save