diff --git a/apps/api/src/app/core/portfolio-calculator.ts b/apps/api/src/app/core/portfolio-calculator.ts index b81231cb6..836c2c06d 100644 --- a/apps/api/src/app/core/portfolio-calculator.ts +++ b/apps/api/src/app/core/portfolio-calculator.ts @@ -389,9 +389,13 @@ export class PortfolioCalculator { let grossPerformancePercentage = new Big(0); let completeInitialValue = new Big(0); for (const currentPosition of positions) { - currentValue = currentValue.add( - new Big(currentPosition.marketPrice).mul(currentPosition.quantity) - ); + if (currentPosition.marketPrice) { + currentValue = currentValue.add( + new Big(currentPosition.marketPrice).mul(currentPosition.quantity) + ); + } else { + hasErrors = true; + } totalInvestment = totalInvestment.add(currentPosition.investment); if (currentPosition.grossPerformance) { grossPerformance = grossPerformance.plus(