Browse Source

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
pull/4799/head
Thomas Kaul 1 month ago
committed by GitHub
parent
commit
c553fdf6d4
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      CHANGELOG.md
  2. 7
      apps/api/src/app/portfolio/portfolio.service.ts
  3. 14
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts
  4. 4
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html
  5. 2
      libs/common/src/lib/interfaces/responses/portfolio-holding-response.interface.ts

4
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

7
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,

14
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;

4
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>

2
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;

Loading…
Cancel
Save