diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index c580ce14..7e373c4c 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -1249,7 +1249,7 @@ export class PortfolioService { const rules: PortfolioReportResponse['rules'] = { accountClusterRisk: - summary.ordersCount > 0 + summary.activityCount > 0 ? await this.rulesService.evaluate( [ new AccountClusterRiskCurrentInvestment( @@ -1265,7 +1265,7 @@ export class PortfolioService { ) : undefined, assetClassClusterRisk: - summary.ordersCount > 0 + summary.activityCount > 0 ? await this.rulesService.evaluate( [ new AssetClassClusterRiskEquity( @@ -1281,7 +1281,7 @@ export class PortfolioService { ) : undefined, currencyClusterRisk: - summary.ordersCount > 0 + summary.activityCount > 0 ? await this.rulesService.evaluate( [ new CurrencyClusterRiskBaseCurrencyCurrentInvestment( @@ -1297,7 +1297,7 @@ export class PortfolioService { ) : undefined, economicMarketClusterRisk: - summary.ordersCount > 0 + summary.activityCount > 0 ? await this.rulesService.evaluate( [ new EconomicMarketClusterRiskDevelopedMarkets( @@ -1338,7 +1338,7 @@ export class PortfolioService { userSettings ), regionalMarketClusterRisk: - summary.ordersCount > 0 + summary.activityCount > 0 ? await this.rulesService.evaluate( [ new RegionalMarketClusterRiskAsiaPacific( @@ -1981,6 +1981,9 @@ export class PortfolioService { netPerformanceWithCurrencyEffect, totalBuy, totalSell, + activityCount: activities.filter(({ type }) => { + return ['BUY', 'SELL'].includes(type); + }).length, committedFunds: committedFunds.toNumber(), currentValueInBaseCurrency: currentValueInBaseCurrency.toNumber(), dividendInBaseCurrency: dividendInBaseCurrency.toNumber(), @@ -2008,9 +2011,6 @@ export class PortfolioService { interest: interest.toNumber(), items: valuables.toNumber(), liabilities: liabilities.toNumber(), - ordersCount: activities.filter(({ type }) => { - return ['BUY', 'SELL'].includes(type); - }).length, totalInvestment: totalInvestment.toNumber(), totalValueInBaseCurrency: netWorth }; diff --git a/apps/api/src/helper/object.helper.spec.ts b/apps/api/src/helper/object.helper.spec.ts index b0370fa3..d7caf9bc 100644 --- a/apps/api/src/helper/object.helper.spec.ts +++ b/apps/api/src/helper/object.helper.spec.ts @@ -1515,6 +1515,7 @@ describe('redactAttributes', () => { } }, summary: { + activityCount: 29, annualizedPerformancePercent: 0.16690880197786, annualizedPerformancePercentWithCurrencyEffect: 0.1694019484552876, cash: null, @@ -1538,7 +1539,6 @@ describe('redactAttributes', () => { interest: null, items: null, liabilities: null, - ordersCount: 29, totalInvestment: null, totalValueInBaseCurrency: null, currentNetWorth: null @@ -3018,6 +3018,7 @@ describe('redactAttributes', () => { } }, summary: { + activityCount: 29, annualizedPerformancePercent: 0.16690880197786, annualizedPerformancePercentWithCurrencyEffect: 0.1694019484552876, cash: null, @@ -3041,7 +3042,6 @@ describe('redactAttributes', () => { interest: null, items: null, liabilities: null, - ordersCount: 29, totalInvestment: null, totalValueInBaseCurrency: null, currentNetWorth: null 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 1a52bd64..265904b8 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 @@ -7,11 +7,11 @@
- {{ summary?.ordersCount }} - {summary?.ordersCount, plural, + {{ summary?.activityCount }} + {summary?.activityCount, plural, =1 {activity} other {activities} } diff --git a/apps/client/src/locales/messages.ca.xlf b/apps/client/src/locales/messages.ca.xlf index d0f37ead..4e4e7e62 100644 --- a/apps/client/src/locales/messages.ca.xlf +++ b/apps/client/src/locales/messages.ca.xlf @@ -2902,7 +2902,7 @@ 3 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {activity} other {activities}} diff --git a/apps/client/src/locales/messages.de.xlf b/apps/client/src/locales/messages.de.xlf index 7671b9e3..f61c91c7 100644 --- a/apps/client/src/locales/messages.de.xlf +++ b/apps/client/src/locales/messages.de.xlf @@ -6586,7 +6586,7 @@ 48 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {Aktivität} other {Aktivitäten}} diff --git a/apps/client/src/locales/messages.es.xlf b/apps/client/src/locales/messages.es.xlf index 53541518..49af3483 100644 --- a/apps/client/src/locales/messages.es.xlf +++ b/apps/client/src/locales/messages.es.xlf @@ -6563,7 +6563,7 @@ 48 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {activity} other {activities}} diff --git a/apps/client/src/locales/messages.fr.xlf b/apps/client/src/locales/messages.fr.xlf index becc95d5..946533d9 100644 --- a/apps/client/src/locales/messages.fr.xlf +++ b/apps/client/src/locales/messages.fr.xlf @@ -6562,7 +6562,7 @@ 48 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {activity} autres {activities}} diff --git a/apps/client/src/locales/messages.it.xlf b/apps/client/src/locales/messages.it.xlf index a3605173..37c66bfd 100644 --- a/apps/client/src/locales/messages.it.xlf +++ b/apps/client/src/locales/messages.it.xlf @@ -6563,7 +6563,7 @@ 48 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {attività} other {attività}} diff --git a/apps/client/src/locales/messages.nl.xlf b/apps/client/src/locales/messages.nl.xlf index f57b34e8..ca56dcc8 100644 --- a/apps/client/src/locales/messages.nl.xlf +++ b/apps/client/src/locales/messages.nl.xlf @@ -6562,7 +6562,7 @@ 48 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {activiteit} other {activiteiten}} diff --git a/apps/client/src/locales/messages.pl.xlf b/apps/client/src/locales/messages.pl.xlf index 40ca77ad..ab45fe32 100644 --- a/apps/client/src/locales/messages.pl.xlf +++ b/apps/client/src/locales/messages.pl.xlf @@ -6562,7 +6562,7 @@ 48 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {activity} other {activities}} diff --git a/apps/client/src/locales/messages.pt.xlf b/apps/client/src/locales/messages.pt.xlf index a6a4f98e..3755a924 100644 --- a/apps/client/src/locales/messages.pt.xlf +++ b/apps/client/src/locales/messages.pt.xlf @@ -6562,7 +6562,7 @@ 48 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {activity} other {activities}} diff --git a/apps/client/src/locales/messages.tr.xlf b/apps/client/src/locales/messages.tr.xlf index 139b727f..2064777a 100644 --- a/apps/client/src/locales/messages.tr.xlf +++ b/apps/client/src/locales/messages.tr.xlf @@ -6562,7 +6562,7 @@ 48 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {Etkinlik} other {Etkinlikler}} diff --git a/apps/client/src/locales/messages.uk.xlf b/apps/client/src/locales/messages.uk.xlf index b095cbbf..5f768b37 100644 --- a/apps/client/src/locales/messages.uk.xlf +++ b/apps/client/src/locales/messages.uk.xlf @@ -2982,7 +2982,7 @@ 3 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {дія} other {дій}} diff --git a/apps/client/src/locales/messages.xlf b/apps/client/src/locales/messages.xlf index e769e715..47252990 100644 --- a/apps/client/src/locales/messages.xlf +++ b/apps/client/src/locales/messages.xlf @@ -6000,7 +6000,7 @@ 8 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html diff --git a/apps/client/src/locales/messages.zh.xlf b/apps/client/src/locales/messages.zh.xlf index e57fec28..1697a519 100644 --- a/apps/client/src/locales/messages.zh.xlf +++ b/apps/client/src/locales/messages.zh.xlf @@ -6563,7 +6563,7 @@ 48 - + {VAR_PLURAL, plural, =1 {activity} other {activities}} {VAR_PLURAL, plural, =1 {活动} other {活动}} diff --git a/libs/common/src/lib/interfaces/portfolio-summary.interface.ts b/libs/common/src/lib/interfaces/portfolio-summary.interface.ts index 42496b22..4030b900 100644 --- a/libs/common/src/lib/interfaces/portfolio-summary.interface.ts +++ b/libs/common/src/lib/interfaces/portfolio-summary.interface.ts @@ -1,6 +1,7 @@ import { PortfolioPerformance } from './portfolio-performance.interface'; export interface PortfolioSummary extends PortfolioPerformance { + activityCount: number; annualizedPerformancePercent: number; annualizedPerformancePercentWithCurrencyEffect: number; cash: number; @@ -21,7 +22,6 @@ export interface PortfolioSummary extends PortfolioPerformance { interest: number; items: number; liabilities: number; - ordersCount: number; totalBuy: number; totalSell: number; totalValueInBaseCurrency?: number;