From 9be457943c9691a2c55517b64e1fd7aa09c6929d Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 18 Apr 2023 20:13:03 +0200 Subject: [PATCH] Feature/introduce allocations by etf provider (#1870) * Introduce allocations by etf provider * Update changelog --- CHANGELOG.md | 6 +++++ .../allocations/allocations-page.component.ts | 23 +++++++++++++++-- .../allocations/allocations-page.html | 25 +++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e419eaaf3..bbbf6e608 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Introduced the allocations by ETF provider chart on the allocations page + ## 1.256.0 - 2023-04-17 ### Added diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts index 64831cb0f..7d541553f 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts @@ -65,7 +65,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { | 'exchange' | 'name' | 'value' - >; + > & { 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,6 +275,10 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { assetClass: position.assetClass, assetSubClass: position.assetSubClass, currency: position.currency, + etfProvider: this.extractEtfProvider({ + assetSubClass: position.assetSubClass, + name: position.name + }), exchange: position.exchange, name: position.name }; @@ -452,4 +456,19 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { }); }); } + + private extractEtfProvider({ + assetSubClass, + name + }: { + assetSubClass: PortfolioPosition['assetSubClass']; + name: string; + }) { + if (assetSubClass === 'ETF') { + const [firstWord] = name.split(' '); + return firstWord; + } + + return UNKNOWN_KEY; + } } diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html index 412527fc7..e618a3db5 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html @@ -249,4 +249,29 @@ +
+
+ + + By ETF Provider + + + + + +
+