From dc1d002552880779bbb12e81e1278f473cef8b0d Mon Sep 17 00:00:00 2001 From: Ivo Valchev Date: Wed, 1 Sep 2021 12:15:00 +0200 Subject: [PATCH] Add a new symbol allocation chart --- .../allocations/allocations-page.component.ts | 16 ++++++++++++- .../allocations/allocations-page.html | 24 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) 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 f1dd34f87..f79c217e8 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 @@ -42,10 +42,12 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { public sectors: { [name: string]: { name: string; value: number }; }; + public symbols: { + [name: string]: { name: string; value: number }; + }; public user: User; private unsubscribeSubject = new Subject(); - /** * @constructor */ @@ -108,6 +110,12 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { }; this.positions = {}; this.positionsArray = []; + this.symbols = { + [UNKNOWN_KEY]: { + name: UNKNOWN_KEY, + value: 0 + } + }; this.sectors = { [UNKNOWN_KEY]: { name: UNKNOWN_KEY, @@ -139,6 +147,12 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { }; this.positionsArray.push(position); + if(this.symbols[symbol] === undefined) { + this.symbols[symbol] = { name: symbol, value: position.value }; + } else { + this.symbols[symbol].value += position.value; + } + if (position.assetClass !== AssetClass.CASH) { // Prepare analysis data by continents, countries and sectors except for cash 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 f9fd44f08..031699298 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html @@ -5,6 +5,30 @@
+
+ + + By Symbol + + + + + + +
+