|
|
@ -65,7 +65,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
| 'exchange' |
|
|
|
| 'name' |
|
|
|
| 'value' |
|
|
|
> & { organization: string }; |
|
|
|
> & { etfProvider: string }; |
|
|
|
}; |
|
|
|
public sectors: { |
|
|
|
[name: string]: { name: string; value: number }; |
|
|
@ -249,7 +249,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
public initializeAnalysisData() { |
|
|
|
this.initialize(); |
|
|
|
|
|
|
|
for (const [id, { current, name, original }] of Object.entries( |
|
|
|
for (const [id, { current, name }] of Object.entries( |
|
|
|
this.portfolioDetails.accounts |
|
|
|
)) { |
|
|
|
this.accounts[id] = { |
|
|
@ -275,13 +275,12 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
assetClass: position.assetClass, |
|
|
|
assetSubClass: position.assetSubClass, |
|
|
|
currency: position.currency, |
|
|
|
exchange: position.exchange, |
|
|
|
name: position.name, |
|
|
|
organization: this.nameToOrganization({ |
|
|
|
assetClass: position.assetClass, |
|
|
|
etfProvider: this.extractEtfProvider({ |
|
|
|
assetSubClass: position.assetSubClass, |
|
|
|
name: position.name |
|
|
|
}) |
|
|
|
}), |
|
|
|
exchange: position.exchange, |
|
|
|
name: position.name |
|
|
|
}; |
|
|
|
|
|
|
|
if (position.assetClass !== AssetClass.CASH) { |
|
|
@ -458,22 +457,18 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private nameToOrganization({ |
|
|
|
assetClass, |
|
|
|
private extractEtfProvider({ |
|
|
|
assetSubClass, |
|
|
|
name |
|
|
|
}: { |
|
|
|
assetClass: AssetClass; |
|
|
|
assetSubClass: PortfolioPosition['assetSubClass']; |
|
|
|
name: string; |
|
|
|
}) { |
|
|
|
if (assetClass.toUpperCase() === 'CASH') { |
|
|
|
return UNKNOWN_KEY; |
|
|
|
} else if (assetSubClass === 'ETF' || name.includes('ETF')) { |
|
|
|
if (assetSubClass === 'ETF') { |
|
|
|
const [firstWord] = name.split(' '); |
|
|
|
return firstWord; |
|
|
|
} |
|
|
|
|
|
|
|
return name; |
|
|
|
return UNKNOWN_KEY; |
|
|
|
} |
|
|
|
} |
|
|
|