|
|
@ -134,11 +134,6 @@ export class GfAllocationsPageComponent implements OnInit { |
|
|
protected readonly UNKNOWN_KEY = UNKNOWN_KEY; |
|
|
protected readonly UNKNOWN_KEY = UNKNOWN_KEY; |
|
|
protected user: User; |
|
|
protected user: User; |
|
|
|
|
|
|
|
|
private topHoldingsMap: { |
|
|
|
|
|
[name: string]: { name: string; value: number }; |
|
|
|
|
|
}; |
|
|
|
|
|
private totalValueInEtf = 0; |
|
|
|
|
|
|
|
|
|
|
|
private readonly changeDetectorRef = inject(ChangeDetectorRef); |
|
|
private readonly changeDetectorRef = inject(ChangeDetectorRef); |
|
|
private readonly dataService = inject(DataService); |
|
|
private readonly dataService = inject(DataService); |
|
|
private readonly destroyRef = inject(DestroyRef); |
|
|
private readonly destroyRef = inject(DestroyRef); |
|
|
@ -365,7 +360,6 @@ export class GfAllocationsPageComponent implements OnInit { |
|
|
value: 0 |
|
|
value: 0 |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
this.topHoldingsMap = {}; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private initializeAllocationsData() { |
|
|
private initializeAllocationsData() { |
|
|
@ -388,7 +382,12 @@ export class GfAllocationsPageComponent implements OnInit { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const topHoldingsMap: { |
|
|
|
|
|
[name: string]: { name: string; value: number }; |
|
|
|
|
|
} = {}; |
|
|
|
|
|
|
|
|
let totalValueExcludingCashPositions = 0; |
|
|
let totalValueExcludingCashPositions = 0; |
|
|
|
|
|
let totalValueInEtf = 0; |
|
|
|
|
|
|
|
|
for (const position of this.portfolioDetails.holdings) { |
|
|
for (const position of this.portfolioDetails.holdings) { |
|
|
const assetProfileIdentifier = getAssetProfileIdentifier( |
|
|
const assetProfileIdentifier = getAssetProfileIdentifier( |
|
|
@ -474,12 +473,12 @@ export class GfAllocationsPageComponent implements OnInit { |
|
|
? valueInBaseCurrency |
|
|
? valueInBaseCurrency |
|
|
: allocationInPercentage * (position.valueInPercentage ?? 0); |
|
|
: allocationInPercentage * (position.valueInPercentage ?? 0); |
|
|
|
|
|
|
|
|
const holdingData = this.topHoldingsMap[normalizedAssetName]; |
|
|
const holdingData = topHoldingsMap[normalizedAssetName]; |
|
|
|
|
|
|
|
|
if (holdingData) { |
|
|
if (holdingData) { |
|
|
holdingData.value += value; |
|
|
holdingData.value += value; |
|
|
} else { |
|
|
} else { |
|
|
this.topHoldingsMap[normalizedAssetName] = { |
|
|
topHoldingsMap[normalizedAssetName] = { |
|
|
name, |
|
|
name, |
|
|
value |
|
|
value |
|
|
}; |
|
|
}; |
|
|
@ -515,7 +514,7 @@ export class GfAllocationsPageComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.holdings[assetProfileIdentifier].assetSubClass === 'ETF') { |
|
|
if (this.holdings[assetProfileIdentifier].assetSubClass === 'ETF') { |
|
|
this.totalValueInEtf += this.holdings[assetProfileIdentifier].value; |
|
|
totalValueInEtf += this.holdings[assetProfileIdentifier].value; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const symbol = position.assetProfile.symbol; |
|
|
const symbol = position.assetProfile.symbol; |
|
|
@ -582,7 +581,7 @@ export class GfAllocationsPageComponent implements OnInit { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.topHoldings = Object.values(this.topHoldingsMap) |
|
|
this.topHoldings = Object.values(topHoldingsMap) |
|
|
.map(({ name, value }): HoldingWithParents => { |
|
|
.map(({ name, value }): HoldingWithParents => { |
|
|
if (this.showValuesInPercentage()) { |
|
|
if (this.showValuesInPercentage()) { |
|
|
return { |
|
|
return { |
|
|
@ -594,7 +593,7 @@ export class GfAllocationsPageComponent implements OnInit { |
|
|
return { |
|
|
return { |
|
|
name, |
|
|
name, |
|
|
allocationInPercentage: |
|
|
allocationInPercentage: |
|
|
this.totalValueInEtf > 0 ? value / this.totalValueInEtf : 0, |
|
|
totalValueInEtf > 0 ? value / totalValueInEtf : 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) { |
|
|
|