Browse Source

Fix top holdings

pull/7980/head
Thomas Kaul 2 weeks ago
parent
commit
d6b6204f21
  1. 13
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts

13
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() {
@ -463,6 +464,8 @@ export class GfAllocationsPageComponent implements OnInit {
} }
if (position.assetProfile.holdings.length > 0) { if (position.assetProfile.holdings.length > 0) {
totalValueInEtf += 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);
@ -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