Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Add guard
Thomasea219f0b8876
diff --git a/apps/api/src/app/core/portfolio-calculator.ts b/apps/api/src/app/core/portfolio-calculator.tsindex b81231cb6f..836c2c06d1 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(