|
@ -260,11 +260,11 @@ export class PortfolioCalculator { |
|
|
currentValuesWithCurrencyEffect: { [date: string]: Big }; |
|
|
currentValuesWithCurrencyEffect: { [date: string]: Big }; |
|
|
investmentValuesAccumulated: { [date: string]: Big }; |
|
|
investmentValuesAccumulated: { [date: string]: Big }; |
|
|
investmentValuesAccumulatedWithCurrencyEffect: { [date: string]: Big }; |
|
|
investmentValuesAccumulatedWithCurrencyEffect: { [date: string]: Big }; |
|
|
|
|
|
investmentValuesWithCurrencyEffect: { [date: string]: Big }; |
|
|
netPerformanceValues: { [date: string]: Big }; |
|
|
netPerformanceValues: { [date: string]: Big }; |
|
|
netPerformanceValuesWithCurrencyEffect: { [date: string]: Big }; |
|
|
netPerformanceValuesWithCurrencyEffect: { [date: string]: Big }; |
|
|
timeWeightedInvestmentValues: { [date: string]: Big }; |
|
|
timeWeightedInvestmentValues: { [date: string]: Big }; |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect: { [date: string]: Big }; |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect: { [date: string]: Big }; |
|
|
transactionValues: { [date: string]: Big }; |
|
|
|
|
|
}; |
|
|
}; |
|
|
} = {}; |
|
|
} = {}; |
|
|
|
|
|
|
|
@ -274,11 +274,11 @@ export class PortfolioCalculator { |
|
|
currentValuesWithCurrencyEffect, |
|
|
currentValuesWithCurrencyEffect, |
|
|
investmentValuesAccumulated, |
|
|
investmentValuesAccumulated, |
|
|
investmentValuesAccumulatedWithCurrencyEffect, |
|
|
investmentValuesAccumulatedWithCurrencyEffect, |
|
|
|
|
|
investmentValuesWithCurrencyEffect, |
|
|
netPerformanceValues, |
|
|
netPerformanceValues, |
|
|
netPerformanceValuesWithCurrencyEffect, |
|
|
netPerformanceValuesWithCurrencyEffect, |
|
|
timeWeightedInvestmentValues, |
|
|
timeWeightedInvestmentValues, |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect, |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect |
|
|
transactionValues |
|
|
|
|
|
} = this.getSymbolMetrics({ |
|
|
} = this.getSymbolMetrics({ |
|
|
end, |
|
|
end, |
|
|
marketSymbolMap, |
|
|
marketSymbolMap, |
|
@ -295,8 +295,8 @@ export class PortfolioCalculator { |
|
|
console.log(date, investmentValuesAccumulated[date].toNumber()); |
|
|
console.log(date, investmentValuesAccumulated[date].toNumber()); |
|
|
} |
|
|
} |
|
|
console.log('---'); |
|
|
console.log('---'); |
|
|
for (const date of Object.keys(transactionValues)) { |
|
|
for (const date of Object.keys(investmentValuesWithCurrencyEffect)) { |
|
|
console.log(date, transactionValues[date].toNumber()); |
|
|
console.log(date, investmentValuesWithCurrencyEffect[date].toNumber()); |
|
|
} |
|
|
} |
|
|
console.log('==='); |
|
|
console.log('==='); |
|
|
|
|
|
|
|
@ -305,11 +305,11 @@ export class PortfolioCalculator { |
|
|
currentValuesWithCurrencyEffect, |
|
|
currentValuesWithCurrencyEffect, |
|
|
investmentValuesAccumulated, |
|
|
investmentValuesAccumulated, |
|
|
investmentValuesAccumulatedWithCurrencyEffect, |
|
|
investmentValuesAccumulatedWithCurrencyEffect, |
|
|
|
|
|
investmentValuesWithCurrencyEffect, |
|
|
netPerformanceValues, |
|
|
netPerformanceValues, |
|
|
netPerformanceValuesWithCurrencyEffect, |
|
|
netPerformanceValuesWithCurrencyEffect, |
|
|
timeWeightedInvestmentValues, |
|
|
timeWeightedInvestmentValues, |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect, |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect |
|
|
transactionValues |
|
|
|
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -330,7 +330,8 @@ export class PortfolioCalculator { |
|
|
symbolValues.investmentValuesAccumulated?.[dateString] ?? new Big(0); |
|
|
symbolValues.investmentValuesAccumulated?.[dateString] ?? new Big(0); |
|
|
|
|
|
|
|
|
const transactionValue = |
|
|
const transactionValue = |
|
|
symbolValues.transactionValues?.[dateString] ?? new Big(0); |
|
|
symbolValues.investmentValuesWithCurrencyEffect?.[dateString] ?? |
|
|
|
|
|
new Big(0); |
|
|
|
|
|
|
|
|
const investmentValueWithCurrencyEffect = |
|
|
const investmentValueWithCurrencyEffect = |
|
|
symbolValues.investmentValuesAccumulatedWithCurrencyEffect?.[ |
|
|
symbolValues.investmentValuesAccumulatedWithCurrencyEffect?.[ |
|
@ -943,12 +944,12 @@ export class PortfolioCalculator { |
|
|
const investmentValuesAccumulatedWithCurrencyEffect: { |
|
|
const investmentValuesAccumulatedWithCurrencyEffect: { |
|
|
[date: string]: Big; |
|
|
[date: string]: Big; |
|
|
} = {}; |
|
|
} = {}; |
|
|
|
|
|
const investmentValuesWithCurrencyEffect: { [date: string]: Big } = {}; |
|
|
let lastAveragePrice = new Big(0); |
|
|
let lastAveragePrice = new Big(0); |
|
|
let lastAveragePriceWithCurrencyEffect = new Big(0); |
|
|
let lastAveragePriceWithCurrencyEffect = new Big(0); |
|
|
const netPerformanceValues: { [date: string]: Big } = {}; |
|
|
const netPerformanceValues: { [date: string]: Big } = {}; |
|
|
const netPerformanceValuesWithCurrencyEffect: { [date: string]: Big } = {}; |
|
|
const netPerformanceValuesWithCurrencyEffect: { [date: string]: Big } = {}; |
|
|
const timeWeightedInvestmentValues: { [date: string]: Big } = {}; |
|
|
const timeWeightedInvestmentValues: { [date: string]: Big } = {}; |
|
|
const transactionValues: { [date: string]: Big } = {}; |
|
|
|
|
|
|
|
|
|
|
|
const timeWeightedInvestmentValuesWithCurrencyEffect: { |
|
|
const timeWeightedInvestmentValuesWithCurrencyEffect: { |
|
|
[date: string]: Big; |
|
|
[date: string]: Big; |
|
@ -986,6 +987,7 @@ export class PortfolioCalculator { |
|
|
initialValueWithCurrencyEffect: new Big(0), |
|
|
initialValueWithCurrencyEffect: new Big(0), |
|
|
investmentValuesAccumulated: {}, |
|
|
investmentValuesAccumulated: {}, |
|
|
investmentValuesAccumulatedWithCurrencyEffect: {}, |
|
|
investmentValuesAccumulatedWithCurrencyEffect: {}, |
|
|
|
|
|
investmentValuesWithCurrencyEffect: {}, |
|
|
netPerformance: new Big(0), |
|
|
netPerformance: new Big(0), |
|
|
netPerformancePercentage: new Big(0), |
|
|
netPerformancePercentage: new Big(0), |
|
|
netPerformancePercentageWithCurrencyEffect: new Big(0), |
|
|
netPerformancePercentageWithCurrencyEffect: new Big(0), |
|
@ -997,8 +999,7 @@ export class PortfolioCalculator { |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect: {}, |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect: {}, |
|
|
timeWeightedInvestmentWithCurrencyEffect: new Big(0), |
|
|
timeWeightedInvestmentWithCurrencyEffect: new Big(0), |
|
|
totalInvestment: new Big(0), |
|
|
totalInvestment: new Big(0), |
|
|
totalInvestmentWithCurrencyEffect: new Big(0), |
|
|
totalInvestmentWithCurrencyEffect: new Big(0) |
|
|
transactionValues: {} |
|
|
|
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1026,6 +1027,7 @@ export class PortfolioCalculator { |
|
|
initialValueWithCurrencyEffect: new Big(0), |
|
|
initialValueWithCurrencyEffect: new Big(0), |
|
|
investmentValuesAccumulated: {}, |
|
|
investmentValuesAccumulated: {}, |
|
|
investmentValuesAccumulatedWithCurrencyEffect: {}, |
|
|
investmentValuesAccumulatedWithCurrencyEffect: {}, |
|
|
|
|
|
investmentValuesWithCurrencyEffect: {}, |
|
|
netPerformance: new Big(0), |
|
|
netPerformance: new Big(0), |
|
|
netPerformancePercentage: new Big(0), |
|
|
netPerformancePercentage: new Big(0), |
|
|
netPerformancePercentageWithCurrencyEffect: new Big(0), |
|
|
netPerformancePercentageWithCurrencyEffect: new Big(0), |
|
@ -1037,8 +1039,7 @@ export class PortfolioCalculator { |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect: {}, |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect: {}, |
|
|
timeWeightedInvestmentWithCurrencyEffect: new Big(0), |
|
|
timeWeightedInvestmentWithCurrencyEffect: new Big(0), |
|
|
totalInvestment: new Big(0), |
|
|
totalInvestment: new Big(0), |
|
|
totalInvestmentWithCurrencyEffect: new Big(0), |
|
|
totalInvestmentWithCurrencyEffect: new Big(0) |
|
|
transactionValues: {} |
|
|
|
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1435,8 +1436,8 @@ export class PortfolioCalculator { |
|
|
) |
|
|
) |
|
|
: new Big(0); |
|
|
: new Big(0); |
|
|
|
|
|
|
|
|
transactionValues[order.date] = ( |
|
|
investmentValuesWithCurrencyEffect[order.date] = ( |
|
|
transactionValues[order.date] ?? new Big(0) |
|
|
investmentValuesWithCurrencyEffect[order.date] ?? new Big(0) |
|
|
).add(transactionInvestmentWithCurrencyEffect); |
|
|
).add(transactionInvestmentWithCurrencyEffect); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -1586,6 +1587,7 @@ export class PortfolioCalculator { |
|
|
initialValueWithCurrencyEffect, |
|
|
initialValueWithCurrencyEffect, |
|
|
investmentValuesAccumulated, |
|
|
investmentValuesAccumulated, |
|
|
investmentValuesAccumulatedWithCurrencyEffect, |
|
|
investmentValuesAccumulatedWithCurrencyEffect, |
|
|
|
|
|
investmentValuesWithCurrencyEffect, |
|
|
netPerformancePercentage, |
|
|
netPerformancePercentage, |
|
|
netPerformancePercentageWithCurrencyEffect, |
|
|
netPerformancePercentageWithCurrencyEffect, |
|
|
netPerformanceValues, |
|
|
netPerformanceValues, |
|
@ -1594,7 +1596,6 @@ export class PortfolioCalculator { |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect, |
|
|
timeWeightedInvestmentValuesWithCurrencyEffect, |
|
|
totalInvestment, |
|
|
totalInvestment, |
|
|
totalInvestmentWithCurrencyEffect, |
|
|
totalInvestmentWithCurrencyEffect, |
|
|
transactionValues, |
|
|
|
|
|
grossPerformance: totalGrossPerformance, |
|
|
grossPerformance: totalGrossPerformance, |
|
|
grossPerformanceWithCurrencyEffect: |
|
|
grossPerformanceWithCurrencyEffect: |
|
|
totalGrossPerformanceWithCurrencyEffect, |
|
|
totalGrossPerformanceWithCurrencyEffect, |
|
|