|
@ -422,33 +422,35 @@ export class PortfolioCalculator { |
|
|
symbol: item.symbol |
|
|
symbol: item.symbol |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
hasAnySymbolMetricsErrors = hasAnySymbolMetricsErrors || hasErrors; |
|
|
if (item.quantity.gt(0)) { |
|
|
initialValues[item.symbol] = initialValue; |
|
|
hasAnySymbolMetricsErrors = hasAnySymbolMetricsErrors || hasErrors; |
|
|
|
|
|
initialValues[item.symbol] = initialValue; |
|
|
positions.push({ |
|
|
|
|
|
averagePrice: item.quantity.eq(0) |
|
|
positions.push({ |
|
|
? new Big(0) |
|
|
averagePrice: item.quantity.eq(0) |
|
|
: item.investment.div(item.quantity), |
|
|
? new Big(0) |
|
|
currency: item.currency, |
|
|
: item.investment.div(item.quantity), |
|
|
dataSource: item.dataSource, |
|
|
currency: item.currency, |
|
|
firstBuyDate: item.firstBuyDate, |
|
|
dataSource: item.dataSource, |
|
|
grossPerformance: !hasErrors ? grossPerformance ?? null : null, |
|
|
firstBuyDate: item.firstBuyDate, |
|
|
grossPerformancePercentage: !hasErrors |
|
|
grossPerformance: !hasErrors ? grossPerformance ?? null : null, |
|
|
? grossPerformancePercentage ?? null |
|
|
grossPerformancePercentage: !hasErrors |
|
|
: null, |
|
|
? grossPerformancePercentage ?? null |
|
|
investment: item.investment, |
|
|
: null, |
|
|
marketPrice: marketValue?.toNumber() ?? null, |
|
|
investment: item.investment, |
|
|
netPerformance: !hasErrors ? netPerformance ?? null : null, |
|
|
marketPrice: marketValue?.toNumber() ?? null, |
|
|
netPerformancePercentage: !hasErrors |
|
|
netPerformance: !hasErrors ? netPerformance ?? null : null, |
|
|
? netPerformancePercentage ?? null |
|
|
netPerformancePercentage: !hasErrors |
|
|
: null, |
|
|
? netPerformancePercentage ?? null |
|
|
quantity: item.quantity, |
|
|
: null, |
|
|
symbol: item.symbol, |
|
|
quantity: item.quantity, |
|
|
transactionCount: item.transactionCount |
|
|
symbol: item.symbol, |
|
|
}); |
|
|
transactionCount: item.transactionCount |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
if (hasErrors) { |
|
|
if (hasErrors) { |
|
|
errors.push({ dataSource: item.dataSource, symbol: item.symbol }); |
|
|
errors.push({ dataSource: item.dataSource, symbol: item.symbol }); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|