Browse Source

Bugfix/top holdings on allocations page (#7980)

* Fix top holdings

* Update changelog
pull/7982/head^2
Thomas Kaul 1 week ago
committed by GitHub
parent
commit
f05fbdd3b0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 17
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts

1
CHANGELOG.md

@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed the colors of the investment chart component (dark mode) - Fixed the colors of the investment chart component (dark mode)
- Fixed the colors of the charts if the appearance is set to light and the operating system uses dark mode - Fixed the colors of the charts if the appearance is set to light and the operating system uses dark mode
- Fixed the allocation column of the top holdings of ETFs on the allocations page after a change of the user settings - Fixed the allocation column of the top holdings of ETFs on the allocations page after a change of the user settings
- Fixed the allocation column of the top holdings of funds other than ETFs on the allocations page
- Fixed the value column of the top holdings of ETFs on the allocations page in the _Presenter View_ - Fixed the value column of the top holdings of ETFs on the allocations page in the _Presenter View_
- Fixed the projected sustainable retirement income on the _FIRE_ page for a projected total amount of zero (experimental) - Fixed the projected sustainable retirement income on the _FIRE_ page for a projected total amount of zero (experimental)
- Fixed the sustainable retirement income on the _FIRE_ page for redacted values - Fixed the sustainable retirement income on the _FIRE_ page for redacted values

17
apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts

@ -130,7 +130,7 @@ export class GfAllocationsPageComponent implements OnInit {
value: number; value: number;
}; };
}; };
protected topHoldings: HoldingWithParents[]; protected topHoldings: HoldingWithParents[] | undefined;
protected readonly UNKNOWN_KEY = UNKNOWN_KEY; protected readonly UNKNOWN_KEY = UNKNOWN_KEY;
protected user: User; protected user: User;
@ -360,6 +360,7 @@ export class GfAllocationsPageComponent implements OnInit {
value: 0 value: 0
} }
}; };
this.topHoldings = undefined;
} }
private initializeAllocationsData() { private initializeAllocationsData() {
@ -387,7 +388,7 @@ export class GfAllocationsPageComponent implements OnInit {
} = {}; } = {};
let totalValueExcludingCashPositions = 0; let totalValueExcludingCashPositions = 0;
let totalValueInEtf = 0; let totalValueInFunds = 0;
for (const position of this.portfolioDetails.holdings) { for (const position of this.portfolioDetails.holdings) {
const assetProfileIdentifier = getAssetProfileIdentifier( const assetProfileIdentifier = getAssetProfileIdentifier(
@ -463,6 +464,8 @@ export class GfAllocationsPageComponent implements OnInit {
} }
if (position.assetProfile.holdings.length > 0) { if (position.assetProfile.holdings.length > 0) {
totalValueInFunds += this.holdings[assetProfileIdentifier].value;
for (const { for (const {
allocationInPercentage, allocationInPercentage,
name, name,
@ -513,10 +516,6 @@ export class GfAllocationsPageComponent implements OnInit {
} }
} }
if (this.holdings[assetProfileIdentifier].assetSubClass === 'ETF') {
totalValueInEtf += this.holdings[assetProfileIdentifier].value;
}
const symbol = position.assetProfile.symbol; const symbol = position.assetProfile.symbol;
const value = this.extractValue(position); const value = this.extractValue(position);
@ -593,7 +592,7 @@ export class GfAllocationsPageComponent implements OnInit {
return { return {
name, name,
allocationInPercentage: allocationInPercentage:
totalValueInEtf > 0 ? value / totalValueInEtf : 0, totalValueInFunds > 0 ? value / totalValueInFunds : 0,
parents: this.portfolioDetails.holdings parents: this.portfolioDetails.holdings
.map((holding) => { .map((holding) => {
if (holding.assetProfile.holdings.length > 0) { if (holding.assetProfile.holdings.length > 0) {
@ -610,7 +609,9 @@ export class GfAllocationsPageComponent implements OnInit {
isNumber(currentParentHolding.valueInBaseCurrency) isNumber(currentParentHolding.valueInBaseCurrency)
? { ? {
allocationInPercentage: allocationInPercentage:
currentParentHolding.valueInBaseCurrency / value, value > 0
? currentParentHolding.valueInBaseCurrency / value
: 0,
name: holding.assetProfile.name ?? '', name: holding.assetProfile.name ?? '',
position: holding, position: holding,
symbol: holding.assetProfile.symbol, symbol: holding.assetProfile.symbol,

Loading…
Cancel
Save