From 2d4b7d2d9741e33a494fedc1964272ea9490b2b5 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 21 Aug 2024 20:56:36 +0200 Subject: [PATCH] Refactoring --- apps/api/src/app/portfolio/portfolio.service.ts | 17 +---------------- .../portfolio-performance.interface.ts | 4 ---- .../interfaces/portfolio-summary.interface.ts | 4 ++++ 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index d00b25be3..79ebbd2d2 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -573,7 +573,6 @@ export class PortfolioService { if (withSummary) { summary = await this.getSummary({ filteredValueInBaseCurrency, - holdings, impersonationId, portfolioCalculator, userCurrency, @@ -1110,10 +1109,6 @@ export class PortfolioService { performance: { currentNetWorth: 0, currentValueInBaseCurrency: 0, - grossPerformance: 0, - grossPerformancePercentage: 0, - grossPerformancePercentageWithCurrencyEffect: 0, - grossPerformanceWithCurrencyEffect: 0, netPerformance: 0, netPerformancePercentage: 0, netPerformancePercentageWithCurrencyEffect: 0, @@ -1145,7 +1140,6 @@ export class PortfolioService { }); const { - grossPerformancePercent, netPerformance, netPerformanceInPercentage, netPerformanceInPercentageWithCurrencyEffect, @@ -1157,7 +1151,6 @@ export class PortfolioService { chart?.length > 0 ? last(chart) : { - grossPerformancePercent: 0, netPerformance: 0, netPerformanceInPercentage: 0, netPerformanceInPercentageWithCurrencyEffect: 0, @@ -1178,13 +1171,7 @@ export class PortfolioService { totalInvestment, currentNetWorth: netWorth, currentValueInBaseCurrency: valueWithCurrencyEffect, - // TODO - grossPerformance: 0, - grossPerformancePercentage: grossPerformancePercent / 100, - grossPerformancePercentageWithCurrencyEffect: 0 / 100, - // TODO - grossPerformanceWithCurrencyEffect: 0, - netPerformancePercentage: netPerformanceInPercentage / 100, + netPerformancePercentage: netPerformanceInPercentage / 100 / 100, netPerformancePercentageWithCurrencyEffect: netPerformanceInPercentageWithCurrencyEffect / 100 } @@ -1582,7 +1569,6 @@ export class PortfolioService { balanceInBaseCurrency, emergencyFundPositionsValueInBaseCurrency, filteredValueInBaseCurrency, - holdings, impersonationId, portfolioCalculator, userCurrency, @@ -1591,7 +1577,6 @@ export class PortfolioService { balanceInBaseCurrency: number; emergencyFundPositionsValueInBaseCurrency: number; filteredValueInBaseCurrency: Big; - holdings: PortfolioDetails['holdings']; impersonationId: string; portfolioCalculator: PortfolioCalculator; userCurrency: string; diff --git a/libs/common/src/lib/interfaces/portfolio-performance.interface.ts b/libs/common/src/lib/interfaces/portfolio-performance.interface.ts index 9d4ac5fab..c0c3802d8 100644 --- a/libs/common/src/lib/interfaces/portfolio-performance.interface.ts +++ b/libs/common/src/lib/interfaces/portfolio-performance.interface.ts @@ -2,10 +2,6 @@ export interface PortfolioPerformance { annualizedPerformancePercent?: number; currentNetWorth?: number; currentValueInBaseCurrency: number; - grossPerformance: number; - grossPerformancePercentage: number; - grossPerformancePercentageWithCurrencyEffect: number; - grossPerformanceWithCurrencyEffect: number; netPerformance: number; netPerformancePercentage: number; netPerformancePercentageWithCurrencyEffect: number; diff --git a/libs/common/src/lib/interfaces/portfolio-summary.interface.ts b/libs/common/src/lib/interfaces/portfolio-summary.interface.ts index de04dc24c..486b9463d 100644 --- a/libs/common/src/lib/interfaces/portfolio-summary.interface.ts +++ b/libs/common/src/lib/interfaces/portfolio-summary.interface.ts @@ -17,6 +17,10 @@ export interface PortfolioSummary extends PortfolioPerformance { filteredValueInPercentage?: number; fireWealth: number; firstOrderDate: Date; + grossPerformance: number; + grossPerformancePercentage: number; + grossPerformancePercentageWithCurrencyEffect: number; + grossPerformanceWithCurrencyEffect: number; interest: number; items: number; liabilities: number;