Browse Source

Refactoring

pull/2948/head
Thomas Kaul 2 years ago
parent
commit
dd81bf74a5
  1. 18
      apps/api/src/app/portfolio/portfolio-calculator.ts

18
apps/api/src/app/portfolio/portfolio-calculator.ts

@ -326,18 +326,18 @@ export class PortfolioCalculator {
symbolValues.currentValuesWithCurrencyEffect?.[dateString] ?? symbolValues.currentValuesWithCurrencyEffect?.[dateString] ??
new Big(0); new Big(0);
const investmentValue = const investmentValueAccumulated =
symbolValues.investmentValuesAccumulated?.[dateString] ?? new Big(0); symbolValues.investmentValuesAccumulated?.[dateString] ?? new Big(0);
const transactionValue = const investmentValueAccumulatedWithCurrencyEffect =
symbolValues.investmentValuesWithCurrencyEffect?.[dateString] ??
new Big(0);
const investmentValueWithCurrencyEffect =
symbolValues.investmentValuesAccumulatedWithCurrencyEffect?.[ symbolValues.investmentValuesAccumulatedWithCurrencyEffect?.[
dateString dateString
] ?? new Big(0); ] ?? new Big(0);
const investmentValueWithCurrencyEffect =
symbolValues.investmentValuesWithCurrencyEffect?.[dateString] ??
new Big(0);
const netPerformanceValue = const netPerformanceValue =
symbolValues.netPerformanceValues?.[dateString] ?? new Big(0); symbolValues.netPerformanceValues?.[dateString] ?? new Big(0);
@ -356,7 +356,7 @@ export class PortfolioCalculator {
accumulatedValuesByDate[dateString] = { accumulatedValuesByDate[dateString] = {
investmentValue: ( investmentValue: (
accumulatedValuesByDate[dateString]?.investmentValue ?? new Big(0) accumulatedValuesByDate[dateString]?.investmentValue ?? new Big(0)
).add(transactionValue), ).add(investmentValueWithCurrencyEffect),
totalCurrentValue: ( totalCurrentValue: (
accumulatedValuesByDate[dateString]?.totalCurrentValue ?? new Big(0) accumulatedValuesByDate[dateString]?.totalCurrentValue ?? new Big(0)
).add(currentValue), ).add(currentValue),
@ -367,11 +367,11 @@ export class PortfolioCalculator {
totalInvestmentValue: ( totalInvestmentValue: (
accumulatedValuesByDate[dateString]?.totalInvestmentValue ?? accumulatedValuesByDate[dateString]?.totalInvestmentValue ??
new Big(0) new Big(0)
).add(investmentValue), ).add(investmentValueAccumulated),
totalInvestmentValueWithCurrencyEffect: ( totalInvestmentValueWithCurrencyEffect: (
accumulatedValuesByDate[dateString] accumulatedValuesByDate[dateString]
?.totalInvestmentValueWithCurrencyEffect ?? new Big(0) ?.totalInvestmentValueWithCurrencyEffect ?? new Big(0)
).add(investmentValueWithCurrencyEffect), ).add(investmentValueAccumulatedWithCurrencyEffect),
totalNetPerformanceValue: ( totalNetPerformanceValue: (
accumulatedValuesByDate[dateString]?.totalNetPerformanceValue ?? accumulatedValuesByDate[dateString]?.totalNetPerformanceValue ??
new Big(0) new Big(0)

Loading…
Cancel
Save