|
|
@ -1269,9 +1269,7 @@ export class PortfolioCalculator {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const averageInvestmentBetweenStartAndEndDate = getAverage(
|
|
|
|
const averageInvestmentBetweenStartAndEndDate = getAverage(
|
|
|
|
Object.values(investmentValues).map((investmentValue) => {
|
|
|
|
Object.values(investmentValues)
|
|
|
|
return investmentValue.toNumber();
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const totalGrossPerformance = grossPerformance.minus(
|
|
|
|
const totalGrossPerformance = grossPerformance.minus(
|
|
|
@ -1286,7 +1284,7 @@ export class PortfolioCalculator {
|
|
|
|
averagePriceAtStartDate.eq(0) ||
|
|
|
|
averagePriceAtStartDate.eq(0) ||
|
|
|
|
averagePriceAtEndDate.eq(0) ||
|
|
|
|
averagePriceAtEndDate.eq(0) ||
|
|
|
|
orders[indexOfStartOrder].unitPrice.eq(0)
|
|
|
|
orders[indexOfStartOrder].unitPrice.eq(0)
|
|
|
|
? averageInvestmentBetweenStartAndEndDate > 0
|
|
|
|
? averageInvestmentBetweenStartAndEndDate.gt(0)
|
|
|
|
? totalGrossPerformance.div(averageInvestmentBetweenStartAndEndDate)
|
|
|
|
? totalGrossPerformance.div(averageInvestmentBetweenStartAndEndDate)
|
|
|
|
: new Big(0)
|
|
|
|
: new Big(0)
|
|
|
|
: // This formula has the issue that buying more units with a price
|
|
|
|
: // This formula has the issue that buying more units with a price
|
|
|
@ -1307,7 +1305,7 @@ export class PortfolioCalculator {
|
|
|
|
averagePriceAtStartDate.eq(0) ||
|
|
|
|
averagePriceAtStartDate.eq(0) ||
|
|
|
|
averagePriceAtEndDate.eq(0) ||
|
|
|
|
averagePriceAtEndDate.eq(0) ||
|
|
|
|
orders[indexOfStartOrder].unitPrice.eq(0)
|
|
|
|
orders[indexOfStartOrder].unitPrice.eq(0)
|
|
|
|
? averageInvestmentBetweenStartAndEndDate > 0
|
|
|
|
? averageInvestmentBetweenStartAndEndDate.gt(0)
|
|
|
|
? totalNetPerformance.div(averageInvestmentBetweenStartAndEndDate)
|
|
|
|
? totalNetPerformance.div(averageInvestmentBetweenStartAndEndDate)
|
|
|
|
: new Big(0)
|
|
|
|
: new Big(0)
|
|
|
|
: // This formula has the issue that buying more units with a price
|
|
|
|
: // This formula has the issue that buying more units with a price
|
|
|
|