|
@ -1101,11 +1101,11 @@ export abstract class PortfolioCalculator { |
|
|
let netPerformanceAtStartDate; |
|
|
let netPerformanceAtStartDate; |
|
|
let netPerformanceWithCurrencyEffectAtStartDate; |
|
|
let netPerformanceWithCurrencyEffectAtStartDate; |
|
|
let netPerformanceInPercentageWithCurrencyEffectAtStartDate; |
|
|
let netPerformanceInPercentageWithCurrencyEffectAtStartDate; |
|
|
let investmentValuesWithCurrencyEffect = []; |
|
|
let totalInvestmentValuesWithCurrencyEffect = []; |
|
|
|
|
|
|
|
|
for (let historicalDataItem of chartData) { |
|
|
for (let historicalDataItem of chartData) { |
|
|
if ( |
|
|
if ( |
|
|
!isBefore(parseDate(historicalDataItem.date), start) && |
|
|
!isBefore(parseDate(historicalDataItem.date), subDays(start, 1)) && |
|
|
!isAfter(parseDate(historicalDataItem.date), end) |
|
|
!isAfter(parseDate(historicalDataItem.date), end) |
|
|
) { |
|
|
) { |
|
|
if (!netPerformanceAtStartDate) { |
|
|
if (!netPerformanceAtStartDate) { |
|
@ -1118,8 +1118,8 @@ export abstract class PortfolioCalculator { |
|
|
historicalDataItem.netPerformanceInPercentageWithCurrencyEffect; |
|
|
historicalDataItem.netPerformanceInPercentageWithCurrencyEffect; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
investmentValuesWithCurrencyEffect.push( |
|
|
totalInvestmentValuesWithCurrencyEffect.push( |
|
|
historicalDataItem.investmentValueWithCurrencyEffect |
|
|
historicalDataItem.totalInvestmentValueWithCurrencyEffect |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
// TODO: Normalize remaining metrics
|
|
|
// TODO: Normalize remaining metrics
|
|
@ -1131,10 +1131,12 @@ export abstract class PortfolioCalculator { |
|
|
historicalDataItem.netPerformanceWithCurrencyEffect - |
|
|
historicalDataItem.netPerformanceWithCurrencyEffect - |
|
|
netPerformanceWithCurrencyEffectAtStartDate, |
|
|
netPerformanceWithCurrencyEffectAtStartDate, |
|
|
netPerformanceInPercentageWithCurrencyEffect: |
|
|
netPerformanceInPercentageWithCurrencyEffect: |
|
|
historicalDataItem.netPerformanceWithCurrencyEffect / |
|
|
((historicalDataItem.netPerformanceWithCurrencyEffect - |
|
|
// TODO: This is not correct yet
|
|
|
netPerformanceWithCurrencyEffectAtStartDate) / |
|
|
(sum(investmentValuesWithCurrencyEffect) / |
|
|
// TODO: Not sure if this is correct
|
|
|
investmentValuesWithCurrencyEffect.length) |
|
|
(sum(totalInvestmentValuesWithCurrencyEffect) / |
|
|
|
|
|
totalInvestmentValuesWithCurrencyEffect.length)) * |
|
|
|
|
|
100 |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|