From c553fdf6d4c8d967aea4f0be4006fc1d161b8ca7 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 31 May 2025 10:22:02 +0200 Subject: [PATCH] Bugfix/change investment value to take currency effects into account in holding detail dialog (#4789) * Change investment value to take currency effects into account * Update changelog --- CHANGELOG.md | 4 ++++ apps/api/src/app/portfolio/portfolio.service.ts | 7 ++++--- .../holding-detail-dialog.component.ts | 14 ++++++++------ .../holding-detail-dialog.html | 4 ++-- .../portfolio-holding-response.interface.ts | 2 +- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 119541163..0888e27a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgraded `big.js` from version `6.2.2` to `7.0.1` - Upgraded `ng-extract-i18n-merge` from version `2.14.3` to `2.15.0` +### Fixed + +- Changed the investment value to take the currency effects into account in the holding detail dialog + ## 2.164.0 - 2025-05-28 ### Changed diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 7e373c4cc..e8f50e1e2 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -663,7 +663,7 @@ export class PortfolioService { grossPerformancePercentWithCurrencyEffect: undefined, grossPerformanceWithCurrencyEffect: undefined, historicalData: [], - investment: undefined, + investmentInBaseCurrencyWithCurrencyEffect: undefined, marketPrice: undefined, marketPriceMax: undefined, marketPriceMin: undefined, @@ -853,7 +853,8 @@ export class PortfolioService { grossPerformanceWithCurrencyEffect: position.grossPerformanceWithCurrencyEffect?.toNumber(), historicalData: historicalDataArray, - investment: position.investment?.toNumber(), + investmentInBaseCurrencyWithCurrencyEffect: + position.investmentWithCurrencyEffect?.toNumber(), netPerformance: position.netPerformance?.toNumber(), netPerformancePercent: position.netPerformancePercentage?.toNumber(), netPerformancePercentWithCurrencyEffect: @@ -952,7 +953,7 @@ export class PortfolioService { grossPerformancePercentWithCurrencyEffect: undefined, grossPerformanceWithCurrencyEffect: undefined, historicalData: historicalDataArray, - investment: 0, + investmentInBaseCurrencyWithCurrencyEffect: 0, netPerformance: undefined, netPerformancePercent: undefined, netPerformancePercentWithCurrencyEffect: undefined, diff --git a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts index 028866009..d866275c0 100644 --- a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts +++ b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts @@ -102,8 +102,8 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { public hasPermissionToCreateOwnTag: boolean; public hasPermissionToReadMarketDataOfOwnAssetProfile: boolean; public historicalDataItems: LineChartItem[]; - public investment: number; - public investmentPrecision = 2; + public investmentInBaseCurrencyWithCurrencyEffect: number; + public investmentInBaseCurrencyWithCurrencyEffectPrecision = 2; public marketDataItems: MarketData[] = []; public marketPrice: number; public marketPriceMax: number; @@ -233,7 +233,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { feeInBaseCurrency, firstBuyDate, historicalData, - investment, + investmentInBaseCurrencyWithCurrencyEffect, marketPrice, marketPriceMax, marketPriceMin, @@ -288,13 +288,15 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { } ); - this.investment = investment; + this.investmentInBaseCurrencyWithCurrencyEffect = + investmentInBaseCurrencyWithCurrencyEffect; if ( this.data.deviceType === 'mobile' && - this.investment >= NUMERICAL_PRECISION_THRESHOLD + this.investmentInBaseCurrencyWithCurrencyEffect >= + NUMERICAL_PRECISION_THRESHOLD ) { - this.investmentPrecision = 0; + this.investmentInBaseCurrencyWithCurrencyEffectPrecision = 0; } this.marketPrice = marketPrice; diff --git a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html index 11898c44e..55ebbcd78 100644 --- a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html +++ b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html @@ -146,9 +146,9 @@ size="medium" [isCurrency]="true" [locale]="data.locale" - [precision]="investmentPrecision" + [precision]="investmentInBaseCurrencyWithCurrencyEffectPrecision" [unit]="data.baseCurrency" - [value]="investment" + [value]="investmentInBaseCurrencyWithCurrencyEffect" >Investment diff --git a/libs/common/src/lib/interfaces/responses/portfolio-holding-response.interface.ts b/libs/common/src/lib/interfaces/responses/portfolio-holding-response.interface.ts index b330e8baa..000460228 100644 --- a/libs/common/src/lib/interfaces/responses/portfolio-holding-response.interface.ts +++ b/libs/common/src/lib/interfaces/responses/portfolio-holding-response.interface.ts @@ -22,7 +22,7 @@ export interface PortfolioHoldingResponse { grossPerformancePercentWithCurrencyEffect: number; grossPerformanceWithCurrencyEffect: number; historicalData: HistoricalDataItem[]; - investment: number; + investmentInBaseCurrencyWithCurrencyEffect: number; marketPrice: number; marketPriceMax: number; marketPriceMin: number;