diff --git a/CHANGELOG.md b/CHANGELOG.md index e5036ab1ab..46ffe1b2ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Extended the net performance on the analysis page to include the dividends (experimental) +- Extended the net performance in the portfolio summary to include the dividends (experimental) - Improved the get quotes functionality of the _Manual_ service - Migrated the _ESLint_ configuration to the flat config format without `FlatCompat` - Upgraded `chartjs-chart-treemap` from version `4.2.0` to `4.2.2` diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 21e615bc21..7350f5fc01 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -2140,6 +2140,7 @@ export class PortfolioService { const { currentValueInBaseCurrency, + dividendPercentageWithCurrencyEffect, netPerformance, netPerformancePercentage, netPerformancePercentageWithCurrencyEffect, @@ -2236,6 +2237,7 @@ export class PortfolioService { cash, currentValueInBaseCurrency, dateOfFirstActivity, + dividendPercentageWithCurrencyEffect, excludedAccountsAndActivities, netPerformance, netPerformancePercentage, 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 8846c14a7c..2130493f03 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 @@ -98,10 +98,29 @@ /> + @if (user?.settings?.isExperimentalFeatures) { +
+
Dividend
+
+ @if (isNumber(summary?.dividendInBaseCurrency)) { + + + } + +
+
+ }
Fees
- @if (summary?.fees || summary?.fees === 0) { + @if (isNumber(summary?.fees)) { - }
@@ -154,7 +173,7 @@ [isLoading]="isLoading" [isPercent]="true" [locale]="locale" - [value]="summary?.netPerformancePercentageWithCurrencyEffect" + [value]="netPerformancePercentageWithCurrencyEffect" /> @@ -367,10 +386,7 @@
Liabilities
- @if ( - summary?.liabilitiesInBaseCurrency || - summary?.liabilitiesInBaseCurrency === 0 - ) { + @if (isNumber(summary?.liabilitiesInBaseCurrency)) { - }
-
-
Dividend
-
- + @if (!user?.settings?.isExperimentalFeatures) { +
+
Dividend
+
+ +
-
+ }
diff --git a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts index dec65ddad9..23e32a0c9c 100644 --- a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts +++ b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts @@ -55,6 +55,7 @@ export class GfPortfolioSummaryComponent implements OnChanges { 'BUY_AND_SELL_ACTIVITIES_TOOLTIP' ); + protected readonly isNumber = isNumber; protected readonly PerformanceCalculationType = PerformanceCalculationType; protected isCashExpanded = false; @@ -136,6 +137,36 @@ export class GfPortfolioSummaryComponent implements OnChanges { ); } + protected get netPerformancePercentageWithCurrencyEffect() { + if ( + !this.user?.settings?.isExperimentalFeatures || + !isNumber(this.summary?.netPerformancePercentageWithCurrencyEffect) + ) { + return this.summary?.netPerformancePercentageWithCurrencyEffect; + } + + // Include the dividends (total return) + return ( + this.summary.netPerformancePercentageWithCurrencyEffect + + (this.summary.dividendPercentageWithCurrencyEffect ?? 0) + ); + } + + protected get netPerformanceWithCurrencyEffect() { + if ( + !this.user?.settings?.isExperimentalFeatures || + !isNumber(this.summary?.netPerformanceWithCurrencyEffect) + ) { + return this.summary?.netPerformanceWithCurrencyEffect; + } + + // Include the dividends (total return) + return ( + this.summary.netPerformanceWithCurrencyEffect + + this.summary.dividendInBaseCurrency + ); + } + public ngOnChanges() { if (this.summary) { if ( diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts index aa57e3d9c8..450749925e 100644 --- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts @@ -133,6 +133,36 @@ export class GfAnalysisPageComponent implements OnInit { addIcons({ copyOutline, ellipsisVertical }); } + protected get netPerformancePercentageWithCurrencyEffect() { + if ( + !this.user?.settings?.isExperimentalFeatures || + !isNumber(this.performance?.netPerformancePercentageWithCurrencyEffect) + ) { + return this.performance?.netPerformancePercentageWithCurrencyEffect; + } + + // Include the dividends (total return) + return ( + this.performance.netPerformancePercentageWithCurrencyEffect + + (this.performance.dividendPercentageWithCurrencyEffect ?? 0) + ); + } + + protected get netPerformanceWithCurrencyEffect() { + if ( + !this.user?.settings?.isExperimentalFeatures || + !isNumber(this.performance?.netPerformanceWithCurrencyEffect) + ) { + return this.performance?.netPerformanceWithCurrencyEffect; + } + + // Include the dividends (total return) + return ( + this.performance.netPerformanceWithCurrencyEffect + + this.performance.dividendInBaseCurrency + ); + } + get savingsRate() { if (!this.savingsRatePerMonth) { return undefined; diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.html b/apps/client/src/app/pages/portfolio/analysis/analysis-page.html index 94a0328755..47cee7af6e 100644 --- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.html +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.html @@ -187,6 +187,45 @@ /> + @if (user?.settings?.isExperimentalFeatures) { +
+
+ Absolute Dividend Performance + @if (user?.subscription?.type === 'Basic') { + + } +
+
+ +
+
+
+
+ Dividend Performance +
+
+ +
+
+ }
@@ -273,52 +312,10 @@ [isLoading]="isLoadingInvestmentChart" [isPercent]="true" [locale]="user?.settings?.locale" - [value]=" - performance?.netPerformancePercentageWithCurrencyEffect - " + [value]="netPerformancePercentageWithCurrencyEffect" /> - @if (user?.settings?.isExperimentalFeatures) { -

-
-
- Absolute Dividend Performance - @if (user?.subscription?.type === 'Basic') { - - } -
-
- -
-
-
-
- Dividend Performance -
-
- -
-
- }