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;
}
}
if (!completeInitialValue.eq(0)) {
grossPerformancePercentage =
grossPerformancePercentage.div(completeInitialValue);
}
return {
currentValue,
grossPerformance,
grossPerformancePercentage,
hasErrors,
totalInvestment,
grossPerformancePercentage:
grossPerformancePercentage.div(completeInitialValue)
totalInvestment
};
}

Loading…
Cancel
Save