Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/introduce allocations by etf provider (#1870)

Thomas Kaul9be457943c96
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e419eaaf38..bbbf6e6088 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 64831cb0f7..7d541553f1 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 412527fc7a..e618a3db59 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 @@
</mat-card>
</div>
</div>
+ <div class="row">
+ <div class="col-md-4">
+ <mat-card appearance="outlined" class="mb-3">
+ <mat-card-header class="overflow-hidden w-100">
+ <mat-card-title class="align-items-center d-flex text-truncate"
+ ><span i18n>By ETF Provider</span
+ ><gf-premium-indicator
+ *ngIf="user?.subscription?.type === 'Basic'"
+ class="ml-1"
+ ></gf-premium-indicator
+ ></mat-card-title>
+ </mat-card-header>
+ <mat-card-content>
+ <gf-portfolio-proportion-chart
+ [baseCurrency]="user?.settings?.baseCurrency"
+ [colorScheme]="user?.settings?.colorScheme"
+ [isInPercent]="hasImpersonationId || user.settings.isRestrictedView"
+ [keys]="['etfProvider']"
+ [locale]="user?.settings?.locale"
+ [positions]="positions"
+ ></gf-portfolio-proportion-chart>
+ </mat-card-content>
+ </mat-card>
+ </div>
+ </div>
</div>