Browse Source

Exclude cash in base currency from portfolio performance calculation

pull/7443/head
Thomas Kaul 1 month ago
parent
commit
fb31e98fa5
  1. 2
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts
  2. 2
      apps/api/src/app/portfolio/portfolio.service.ts
  3. 24
      apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html

2
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 * The holding itself keeps its investment and value so that it remains
* visible in the holdings table * visible in the holdings table
*/ */
expect(position).toMatchObject({ expect(position).toMatchObject<Partial<TimelinePosition>>({
currency: 'CHF', currency: 'CHF',
grossPerformance: new Big(0), grossPerformance: new Big(0),
grossPerformanceWithCurrencyEffect: new Big(0), grossPerformanceWithCurrencyEffect: new Big(0),

2
apps/api/src/app/portfolio/portfolio.service.ts

@ -2042,7 +2042,7 @@ export class PortfolioService {
interestInBaseCurrency: interest.toNumber(), interestInBaseCurrency: interest.toNumber(),
liabilitiesInBaseCurrency: liabilities.toNumber(), liabilitiesInBaseCurrency: liabilities.toNumber(),
totalAssetsInBaseCurrency: totalAssetsInBaseCurrency.toNumber(), totalAssetsInBaseCurrency: totalAssetsInBaseCurrency.toNumber(),
totalCashInBaseCurrency: balanceInBaseCurrency, totalCashInBaseCurrency: totalCashInBaseCurrency.toNumber(),
totalInvestment: totalInvestment.toNumber(), totalInvestment: totalInvestment.toNumber(),
totalInvestmentValueWithCurrencyEffect: totalInvestmentValueWithCurrencyEffect:
totalInvestmentWithCurrencyEffect.toNumber(), totalInvestmentWithCurrencyEffect.toNumber(),

24
apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html

@ -166,7 +166,11 @@
<div class="flex-nowrap px-3 py-1 row"> <div class="flex-nowrap px-3 py-1 row">
<div class="align-items-center d-flex flex-grow-1 indent-1"> <div class="align-items-center d-flex flex-grow-1 indent-1">
<ng-container i18n>Cash</ng-container> <ng-container i18n>Cash</ng-container>
@if (!hasImpersonationId && summary?.totalValueInBaseCurrency > 0) { @if (
!hasImpersonationId &&
summary?.totalValueInBaseCurrency > 0 &&
user?.settings?.isExperimentalFeatures
) {
<gf-value <gf-value
class="d-lg-inline-block d-none ml-2 small text-muted" class="d-lg-inline-block d-none ml-2 small text-muted"
[isPercent]="true" [isPercent]="true"
@ -220,7 +224,11 @@
<div class="flex-nowrap px-3 py-1 row"> <div class="flex-nowrap px-3 py-1 row">
<div class="align-items-center d-flex flex-grow-1 indent-1"> <div class="align-items-center d-flex flex-grow-1 indent-1">
<ng-container i18n>Holdings</ng-container> <ng-container i18n>Holdings</ng-container>
@if (!hasImpersonationId && summary?.totalValueInBaseCurrency > 0) { @if (
!hasImpersonationId &&
summary?.totalValueInBaseCurrency > 0 &&
user?.settings?.isExperimentalFeatures
) {
<gf-value <gf-value
class="d-lg-inline-block d-none ml-2 small text-muted" class="d-lg-inline-block d-none ml-2 small text-muted"
[isPercent]="true" [isPercent]="true"
@ -260,7 +268,11 @@
<div class="flex-nowrap px-3 py-1 row"> <div class="flex-nowrap px-3 py-1 row">
<div class="align-items-center d-flex flex-grow-1"> <div class="align-items-center d-flex flex-grow-1">
<ng-container i18n>Excluded from Analysis</ng-container> <ng-container i18n>Excluded from Analysis</ng-container>
@if (!hasImpersonationId && summary?.totalValueInBaseCurrency > 0) { @if (
!hasImpersonationId &&
summary?.totalValueInBaseCurrency > 0 &&
user?.settings?.isExperimentalFeatures
) {
<gf-value <gf-value
class="d-lg-inline-block d-none ml-2 small text-muted" class="d-lg-inline-block d-none ml-2 small text-muted"
[isPercent]="true" [isPercent]="true"
@ -342,7 +354,11 @@
<div class="flex-nowrap px-3 py-1 row"> <div class="flex-nowrap px-3 py-1 row">
<div class="align-items-center d-flex flex-grow-1"> <div class="align-items-center d-flex flex-grow-1">
<ng-container i18n>Emergency Fund</ng-container> <ng-container i18n>Emergency Fund</ng-container>
@if (!hasImpersonationId && summary?.totalValueInBaseCurrency > 0) { @if (
!hasImpersonationId &&
summary?.totalValueInBaseCurrency > 0 &&
user?.settings?.isExperimentalFeatures
) {
<gf-value <gf-value
class="d-lg-inline-block d-none ml-2 small text-muted" class="d-lg-inline-block d-none ml-2 small text-muted"
[isPercent]="true" [isPercent]="true"

Loading…
Cancel
Save