From ece43087fa4f9f194148a523e4f3a87de7d272f8 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 29 Jun 2025 21:26:28 +0200 Subject: [PATCH] Refactor portfolio service --- .../src/app/portfolio/portfolio.service.ts | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 38a355cab..8c413b2c3 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -720,7 +720,16 @@ export class PortfolioService { dividendInBaseCurrency, fee, firstBuyDate, + grossPerformance, + grossPerformancePercentage, + grossPerformancePercentageWithCurrencyEffect, + grossPerformanceWithCurrencyEffect, + investmentWithCurrencyEffect, marketPrice, + netPerformance, + netPerformancePercentage, + netPerformancePercentageWithCurrencyEffectMap, + netPerformanceWithCurrencyEffectMap, quantity, tags, timeWeightedInvestment, @@ -856,23 +865,21 @@ export class PortfolioService { SymbolProfile.currency, userCurrency ), - grossPerformance: holding.grossPerformance?.toNumber(), - grossPerformancePercent: holding.grossPerformancePercentage?.toNumber(), + grossPerformance: grossPerformance?.toNumber(), + grossPerformancePercent: grossPerformancePercentage?.toNumber(), grossPerformancePercentWithCurrencyEffect: - holding.grossPerformancePercentageWithCurrencyEffect?.toNumber(), + grossPerformancePercentageWithCurrencyEffect?.toNumber(), grossPerformanceWithCurrencyEffect: - holding.grossPerformanceWithCurrencyEffect?.toNumber(), + grossPerformanceWithCurrencyEffect?.toNumber(), historicalData: historicalDataArray, investmentInBaseCurrencyWithCurrencyEffect: - holding.investmentWithCurrencyEffect?.toNumber(), - netPerformance: holding.netPerformance?.toNumber(), - netPerformancePercent: holding.netPerformancePercentage?.toNumber(), + investmentWithCurrencyEffect?.toNumber(), + netPerformance: netPerformance?.toNumber(), + netPerformancePercent: netPerformancePercentage?.toNumber(), netPerformancePercentWithCurrencyEffect: - holding.netPerformancePercentageWithCurrencyEffectMap?.[ - 'max' - ]?.toNumber(), + netPerformancePercentageWithCurrencyEffectMap?.['max']?.toNumber(), netPerformanceWithCurrencyEffect: - holding.netPerformanceWithCurrencyEffectMap?.['max']?.toNumber(), + netPerformanceWithCurrencyEffectMap?.['max']?.toNumber(), performances: { allTimeHigh: { performancePercent,