Add guard
This commit is contained in:
parent
23b2e03923
commit
ea219f0b88
@ -389,9 +389,13 @@ export class PortfolioCalculator {
|
|||||||
let grossPerformancePercentage = new Big(0);
|
let grossPerformancePercentage = new Big(0);
|
||||||
let completeInitialValue = new Big(0);
|
let completeInitialValue = new Big(0);
|
||||||
for (const currentPosition of positions) {
|
for (const currentPosition of positions) {
|
||||||
currentValue = currentValue.add(
|
if (currentPosition.marketPrice) {
|
||||||
new Big(currentPosition.marketPrice).mul(currentPosition.quantity)
|
currentValue = currentValue.add(
|
||||||
);
|
new Big(currentPosition.marketPrice).mul(currentPosition.quantity)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
hasErrors = true;
|
||||||
|
}
|
||||||
totalInvestment = totalInvestment.add(currentPosition.investment);
|
totalInvestment = totalInvestment.add(currentPosition.investment);
|
||||||
if (currentPosition.grossPerformance) {
|
if (currentPosition.grossPerformance) {
|
||||||
grossPerformance = grossPerformance.plus(
|
grossPerformance = grossPerformance.plus(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user