From fb31e98fa533af2b8fdbf886e8c944502e876072 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 27 Jul 2026 21:09:11 +0200 Subject: [PATCH] Exclude cash in base currency from portfolio performance calculation --- .../roai/portfolio-calculator-cash.spec.ts | 2 +- .../src/app/portfolio/portfolio.service.ts | 2 +- .../portfolio-summary.component.html | 24 +++++++++++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts index 182e3c5367..9bef6ad394 100644 --- a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts +++ b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts @@ -410,7 +410,7 @@ describe('PortfolioCalculator', () => { * The holding itself keeps its investment and value so that it remains * visible in the holdings table */ - expect(position).toMatchObject({ + expect(position).toMatchObject>({ currency: 'CHF', grossPerformance: new Big(0), grossPerformanceWithCurrencyEffect: new Big(0), diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 2b8640d38e..357d4c6fec 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -2042,7 +2042,7 @@ export class PortfolioService { interestInBaseCurrency: interest.toNumber(), liabilitiesInBaseCurrency: liabilities.toNumber(), totalAssetsInBaseCurrency: totalAssetsInBaseCurrency.toNumber(), - totalCashInBaseCurrency: balanceInBaseCurrency, + totalCashInBaseCurrency: totalCashInBaseCurrency.toNumber(), totalInvestment: totalInvestment.toNumber(), totalInvestmentValueWithCurrencyEffect: totalInvestmentWithCurrencyEffect.toNumber(), diff --git a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html index 5669103724..fd0ac9b72f 100644 --- a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html +++ b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html @@ -166,7 +166,11 @@
Cash - @if (!hasImpersonationId && summary?.totalValueInBaseCurrency > 0) { + @if ( + !hasImpersonationId && + summary?.totalValueInBaseCurrency > 0 && + user?.settings?.isExperimentalFeatures + ) {
Holdings - @if (!hasImpersonationId && summary?.totalValueInBaseCurrency > 0) { + @if ( + !hasImpersonationId && + summary?.totalValueInBaseCurrency > 0 && + user?.settings?.isExperimentalFeatures + ) {
Excluded from Analysis - @if (!hasImpersonationId && summary?.totalValueInBaseCurrency > 0) { + @if ( + !hasImpersonationId && + summary?.totalValueInBaseCurrency > 0 && + user?.settings?.isExperimentalFeatures + ) {
Emergency Fund - @if (!hasImpersonationId && summary?.totalValueInBaseCurrency > 0) { + @if ( + !hasImpersonationId && + summary?.totalValueInBaseCurrency > 0 && + user?.settings?.isExperimentalFeatures + ) {