From 14eed960b43bbdd9c682808417ad451874894f43 Mon Sep 17 00:00:00 2001 From: Dan Date: Sat, 1 Feb 2025 12:26:26 +0100 Subject: [PATCH] Extract tag holding outside of Non-Cyrpto calculation --- .../allocations/allocations-page.component.ts | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) 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 bedab34ea..f253aecfa 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 @@ -346,6 +346,22 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { name: position.name }; + if (position.tags.length > 0) { + for (const tag of position.tags) { + const { name } = tag; + + if (this.tagHoldingsMap[name]?.value) { + this.tagHoldingsMap[name].value += + position.valueInBaseCurrency ?? 0; + } else { + this.tagHoldingsMap[name] = { + name, + value: position.valueInBaseCurrency ?? 0 + }; + } + } + } + if (position.assetClass !== AssetClass.LIQUIDITY) { // Prepare analysis data by continents, countries, holdings and sectors except for liquidity @@ -423,22 +439,6 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { } } - if (position.tags.length > 0) { - for (const tag of position.tags) { - const { name } = tag; - - if (this.tagHoldingsMap[name]?.value) { - this.tagHoldingsMap[name].value += - position.valueInBaseCurrency ?? 0; - } else { - this.tagHoldingsMap[name] = { - name, - value: position.valueInBaseCurrency ?? 0 - }; - } - } - } - if (position.sectors.length > 0) { for (const sector of position.sectors) { const { name, weight } = sector;