Browse Source

Fix division by zero

pull/3695/head
Thomas Kaul 1 year ago
parent
commit
bd26b9b62d
  1. 8
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts

8
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts

@ -713,9 +713,13 @@ export abstract class PortfolioCalculator {
netPerformanceWithCurrencyEffect:
netPerformanceWithCurrencyEffectSinceStartDate,
netPerformanceInPercentage:
netPerformanceSinceStartDate / timeWeightedInvestmentValue,
timeWeightedInvestmentValue === 0
? 0
: netPerformanceSinceStartDate / timeWeightedInvestmentValue,
netPerformanceInPercentageWithCurrencyEffect:
netPerformanceWithCurrencyEffectSinceStartDate /
timeWeightedInvestmentValue === 0
? 0
: netPerformanceWithCurrencyEffectSinceStartDate /
timeWeightedInvestmentValue,
// TODO: Add net worth with valuables
// netWorth: totalCurrentValueWithCurrencyEffect

Loading…
Cancel
Save