Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/change investment value to take currency effects into account in holding detail dialog (#4789)

Thomas Kaulc553fdf6d4c8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1195411631..0888e27a2e 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 7e373c4ccc..e8f50e1e24 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 0288660091..d866275c00 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 11898c44e9..55ebbcd782 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</gf-value
>
</div>
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 b330e8baa0..0004602288 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;