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 `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` - 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 ## 2.164.0 - 2025-05-28
### Changed ### Changed

7
apps/api/src/app/portfolio/portfolio.service.ts

@ -663,7 +663,7 @@ export class PortfolioService {
grossPerformancePercentWithCurrencyEffect: undefined, grossPerformancePercentWithCurrencyEffect: undefined,
grossPerformanceWithCurrencyEffect: undefined, grossPerformanceWithCurrencyEffect: undefined,
historicalData: [], historicalData: [],
investment: undefined, investmentInBaseCurrencyWithCurrencyEffect: undefined,
marketPrice: undefined, marketPrice: undefined,
marketPriceMax: undefined, marketPriceMax: undefined,
marketPriceMin: undefined, marketPriceMin: undefined,
@ -853,7 +853,8 @@ export class PortfolioService {
grossPerformanceWithCurrencyEffect: grossPerformanceWithCurrencyEffect:
position.grossPerformanceWithCurrencyEffect?.toNumber(), position.grossPerformanceWithCurrencyEffect?.toNumber(),
historicalData: historicalDataArray, historicalData: historicalDataArray,
investment: position.investment?.toNumber(), investmentInBaseCurrencyWithCurrencyEffect:
position.investmentWithCurrencyEffect?.toNumber(),
netPerformance: position.netPerformance?.toNumber(), netPerformance: position.netPerformance?.toNumber(),
netPerformancePercent: position.netPerformancePercentage?.toNumber(), netPerformancePercent: position.netPerformancePercentage?.toNumber(),
netPerformancePercentWithCurrencyEffect: netPerformancePercentWithCurrencyEffect:
@ -952,7 +953,7 @@ export class PortfolioService {
grossPerformancePercentWithCurrencyEffect: undefined, grossPerformancePercentWithCurrencyEffect: undefined,
grossPerformanceWithCurrencyEffect: undefined, grossPerformanceWithCurrencyEffect: undefined,
historicalData: historicalDataArray, historicalData: historicalDataArray,
investment: 0, investmentInBaseCurrencyWithCurrencyEffect: 0,
netPerformance: undefined, netPerformance: undefined,
netPerformancePercent: undefined, netPerformancePercent: undefined,
netPerformancePercentWithCurrencyEffect: 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 hasPermissionToCreateOwnTag: boolean;
public hasPermissionToReadMarketDataOfOwnAssetProfile: boolean; public hasPermissionToReadMarketDataOfOwnAssetProfile: boolean;
public historicalDataItems: LineChartItem[]; public historicalDataItems: LineChartItem[];
public investment: number; public investmentInBaseCurrencyWithCurrencyEffect: number;
public investmentPrecision = 2; public investmentInBaseCurrencyWithCurrencyEffectPrecision = 2;
public marketDataItems: MarketData[] = []; public marketDataItems: MarketData[] = [];
public marketPrice: number; public marketPrice: number;
public marketPriceMax: number; public marketPriceMax: number;
@ -233,7 +233,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
feeInBaseCurrency, feeInBaseCurrency,
firstBuyDate, firstBuyDate,
historicalData, historicalData,
investment, investmentInBaseCurrencyWithCurrencyEffect,
marketPrice, marketPrice,
marketPriceMax, marketPriceMax,
marketPriceMin, marketPriceMin,
@ -288,13 +288,15 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
} }
); );
this.investment = investment; this.investmentInBaseCurrencyWithCurrencyEffect =
investmentInBaseCurrencyWithCurrencyEffect;
if ( if (
this.data.deviceType === 'mobile' && this.data.deviceType === 'mobile' &&
this.investment >= NUMERICAL_PRECISION_THRESHOLD this.investmentInBaseCurrencyWithCurrencyEffect >=
NUMERICAL_PRECISION_THRESHOLD
) { ) {
this.investmentPrecision = 0; this.investmentInBaseCurrencyWithCurrencyEffectPrecision = 0;
} }
this.marketPrice = marketPrice; this.marketPrice = marketPrice;

4
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html

@ -146,9 +146,9 @@
size="medium" size="medium"
[isCurrency]="true" [isCurrency]="true"
[locale]="data.locale" [locale]="data.locale"
[precision]="investmentPrecision" [precision]="investmentInBaseCurrencyWithCurrencyEffectPrecision"
[unit]="data.baseCurrency" [unit]="data.baseCurrency"
[value]="investment" [value]="investmentInBaseCurrencyWithCurrencyEffect"
>Investment</gf-value >Investment</gf-value
> >
</div> </div>

2
libs/common/src/lib/interfaces/responses/portfolio-holding-response.interface.ts

@ -22,7 +22,7 @@ export interface PortfolioHoldingResponse {
grossPerformancePercentWithCurrencyEffect: number; grossPerformancePercentWithCurrencyEffect: number;
grossPerformanceWithCurrencyEffect: number; grossPerformanceWithCurrencyEffect: number;
historicalData: HistoricalDataItem[]; historicalData: HistoricalDataItem[];
investment: number; investmentInBaseCurrencyWithCurrencyEffect: number;
marketPrice: number; marketPrice: number;
marketPriceMax: number; marketPriceMax: number;
marketPriceMin: number; marketPriceMin: number;

Loading…
Cancel
Save