|
|
@ -554,6 +554,16 @@ export class RoaiPortfolioCalculator extends PortfolioCalculator { |
|
|
|
|
|
|
|
initialValueWithCurrencyEffect = |
|
|
|
transactionInvestmentWithCurrencyEffect; |
|
|
|
} else if ( |
|
|
|
order.quantity.gt(0) && |
|
|
|
['BUY', 'SELL'].includes(order.type) && |
|
|
|
!order.itemType |
|
|
|
) { |
|
|
|
initialValue = order.quantity.mul(marketPriceInBaseCurrency); |
|
|
|
|
|
|
|
initialValueWithCurrencyEffect = order.quantity.mul( |
|
|
|
marketPriceInBaseCurrencyWithCurrencyEffect |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -783,6 +793,8 @@ export class RoaiPortfolioCalculator extends PortfolioCalculator { |
|
|
|
? totalGrossPerformance.div( |
|
|
|
timeWeightedAverageInvestmentBetweenStartAndEndDate |
|
|
|
) |
|
|
|
: totalGrossPerformance |
|
|
|
? new Big(1) |
|
|
|
: new Big(0); |
|
|
|
|
|
|
|
const grossPerformancePercentageWithCurrencyEffect = |
|
|
@ -792,6 +804,8 @@ export class RoaiPortfolioCalculator extends PortfolioCalculator { |
|
|
|
? totalGrossPerformanceWithCurrencyEffect.div( |
|
|
|
timeWeightedAverageInvestmentBetweenStartAndEndDateWithCurrencyEffect |
|
|
|
) |
|
|
|
: totalGrossPerformanceWithCurrencyEffect |
|
|
|
? new Big(1) |
|
|
|
: new Big(0); |
|
|
|
|
|
|
|
const feesPerUnit = totalUnits.gt(0) |
|
|
@ -809,6 +823,8 @@ export class RoaiPortfolioCalculator extends PortfolioCalculator { |
|
|
|
? totalNetPerformance.div( |
|
|
|
timeWeightedAverageInvestmentBetweenStartAndEndDate |
|
|
|
) |
|
|
|
: totalNetPerformance |
|
|
|
? new Big(1) |
|
|
|
: new Big(0); |
|
|
|
|
|
|
|
const netPerformancePercentageWithCurrencyEffectMap: { |
|
|
@ -902,6 +918,8 @@ export class RoaiPortfolioCalculator extends PortfolioCalculator { |
|
|
|
|
|
|
|
netPerformancePercentageWithCurrencyEffectMap[dateRange] = average.gt(0) |
|
|
|
? netPerformanceWithCurrencyEffectMap[dateRange].div(average) |
|
|
|
: netPerformanceWithCurrencyEffectMap[dateRange] |
|
|
|
? new Big(1) |
|
|
|
: new Big(0); |
|
|
|
} |
|
|
|
|
|
|
@ -938,9 +956,11 @@ export class RoaiPortfolioCalculator extends PortfolioCalculator { |
|
|
|
Net performance: ${totalNetPerformance.toFixed( |
|
|
|
2 |
|
|
|
)} / ${netPerformancePercentage.mul(100).toFixed(2)}% |
|
|
|
Net performance with currency effect: ${netPerformancePercentageWithCurrencyEffectMap[ |
|
|
|
'max' |
|
|
|
].toFixed(2)}%` |
|
|
|
Net performance with currency effect: ${netPerformanceValuesWithCurrencyEffect[ |
|
|
|
endDateString |
|
|
|
].toFixed(2)} / ${netPerformancePercentageWithCurrencyEffectMap['max'] |
|
|
|
.mul(100) |
|
|
|
.toFixed(2)}%` |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|