Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/rename allocation cluster risk x ray rule (#3994)
Thomas Kaul5de176a7ef82
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f419ecfaf7..0dcbcc7419 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Changed- Restructured the resources page+- Renamed the static portfolio analysis rule from _Allocation Cluster Risk_ to _Economic Market Cluster Risk_ (Developed Markets and Emerging Markets)- Improved the language localization for German (`de`)- Switched the `consistent-generic-constructors` rule from `warn` to `error` in the `eslint` configuration- Switched the `consistent-type-assertions` rule from `warn` to `error` in the `eslint` configuration@@ -29,15 +30,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Fixed an issue with the X-axis scale of the dividend timeline on the analysis page- Fixed an issue with the X-axis scale of the investment timeline on the analysis page- Fixed an issue with the X-axis scale of the portfolio evolution chart on the analysis page-- Fixed an issue in the calculation of the static portfolio analysis rule: Allocation Cluster Risk (Developed Markets)-- Fixed an issue in the calculation of the static portfolio analysis rule: Allocation Cluster Risk (Emerging Markets)+- Fixed an issue in the calculation of the static portfolio analysis rule: _Allocation Cluster Risk_ (Developed Markets)+- Fixed an issue in the calculation of the static portfolio analysis rule: _Allocation Cluster Risk_ (Emerging Markets)## 2.118.0 - 2024-10-23### Added-- Added a new static portfolio analysis rule: Allocation Cluster Risk (Developed Markets)-- Added a new static portfolio analysis rule: Allocation Cluster Risk (Emerging Markets)+- Added a new static portfolio analysis rule: _Allocation Cluster Risk_ (Developed Markets)+- Added a new static portfolio analysis rule: _Allocation Cluster Risk_ (Emerging Markets)- Added support for mutual funds in the _EOD Historical Data_ service### Changeddiff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.tsindex d88d925a4e..d4018686c9 100644--- a/apps/api/src/app/portfolio/portfolio.service.ts+++ b/apps/api/src/app/portfolio/portfolio.service.ts@@ -7,10 +7,10 @@ import { UserService } from '@ghostfolio/api/app/user/user.service';import { getFactor } from '@ghostfolio/api/helper/portfolio.helper';import { AccountClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/account-cluster-risk/current-investment';import { AccountClusterRiskSingleAccount } from '@ghostfolio/api/models/rules/account-cluster-risk/single-account';-import { AllocationClusterRiskDevelopedMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/developed-markets';-import { AllocationClusterRiskEmergingMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/emerging-markets';import { CurrencyClusterRiskBaseCurrencyCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/base-currency-current-investment';import { CurrencyClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/current-investment';+import { EconomicMarketClusterRiskDevelopedMarkets } from '@ghostfolio/api/models/rules/economic-market-cluster-risk/developed-markets';+import { EconomicMarketClusterRiskEmergingMarkets } from '@ghostfolio/api/models/rules/economic-market-cluster-risk/emerging-markets';import { EmergencyFundSetup } from '@ghostfolio/api/models/rules/emergency-fund/emergency-fund-setup';import { FeeRatioInitialInvestment } from '@ghostfolio/api/models/rules/fees/fee-ratio-initial-investment';import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service';@@ -1193,16 +1193,16 @@ export class PortfolioService {userSettings): undefined,- allocationClusterRisk:+ economicMarketClusterRisk:summary.ordersCount > 0? await this.rulesService.evaluate([- new AllocationClusterRiskDevelopedMarkets(+ new EconomicMarketClusterRiskDevelopedMarkets(this.exchangeRateDataService,marketsTotalInBaseCurrency,markets.developedMarkets.valueInBaseCurrency),- new AllocationClusterRiskEmergingMarkets(+ new EconomicMarketClusterRiskEmergingMarkets(this.exchangeRateDataService,marketsTotalInBaseCurrency,markets.emergingMarkets.valueInBaseCurrencydiff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.tsindex 556d283409..288e2aba2e 100644--- a/apps/api/src/app/user/user.service.ts+++ b/apps/api/src/app/user/user.service.ts@@ -4,10 +4,10 @@ import { environment } from '@ghostfolio/api/environments/environment';import { PortfolioChangedEvent } from '@ghostfolio/api/events/portfolio-changed.event';import { AccountClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/account-cluster-risk/current-investment';import { AccountClusterRiskSingleAccount } from '@ghostfolio/api/models/rules/account-cluster-risk/single-account';-import { AllocationClusterRiskDevelopedMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/developed-markets';-import { AllocationClusterRiskEmergingMarkets } from '@ghostfolio/api/models/rules/allocation-cluster-risk/emerging-markets';import { CurrencyClusterRiskBaseCurrencyCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/base-currency-current-investment';import { CurrencyClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/current-investment';+import { EconomicMarketClusterRiskDevelopedMarkets } from '@ghostfolio/api/models/rules/economic-market-cluster-risk/developed-markets';+import { EconomicMarketClusterRiskEmergingMarkets } from '@ghostfolio/api/models/rules/economic-market-cluster-risk/emerging-markets';import { EmergencyFundSetup } from '@ghostfolio/api/models/rules/emergency-fund/emergency-fund-setup';import { FeeRatioInitialInvestment } from '@ghostfolio/api/models/rules/fees/fee-ratio-initial-investment';import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';@@ -217,14 +217,14 @@ export class UserService {undefined,{}).getSettings(user.Settings.settings),- AllocationClusterRiskDevelopedMarkets:- new AllocationClusterRiskDevelopedMarkets(+ EconomicMarketClusterRiskDevelopedMarkets:+ new EconomicMarketClusterRiskDevelopedMarkets(undefined,undefined,undefined).getSettings(user.Settings.settings),- AllocationClusterRiskEmergingMarkets:- new AllocationClusterRiskEmergingMarkets(+ EconomicMarketClusterRiskEmergingMarkets:+ new EconomicMarketClusterRiskEmergingMarkets(undefined,undefined,undefineddiff --git a/apps/api/src/models/rules/allocation-cluster-risk/developed-markets.ts b/apps/api/src/models/rules/economic-market-cluster-risk/developed-markets.tssimilarity index 95%rename from apps/api/src/models/rules/allocation-cluster-risk/developed-markets.tsrename to apps/api/src/models/rules/economic-market-cluster-risk/developed-markets.tsindex 068ebdda3c..15e1139274 100644--- a/apps/api/src/models/rules/allocation-cluster-risk/developed-markets.ts+++ b/apps/api/src/models/rules/economic-market-cluster-risk/developed-markets.ts@@ -3,7 +3,7 @@ import { Rule } from '@ghostfolio/api/models/rule';import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';import { UserSettings } from '@ghostfolio/common/interfaces';-export class AllocationClusterRiskDevelopedMarkets extends Rule<Settings> {+export class EconomicMarketClusterRiskDevelopedMarkets extends Rule<Settings> {private currentValueInBaseCurrency: number;private developedMarketsValueInBaseCurrency: number;@@ -13,7 +13,7 @@ export class AllocationClusterRiskDevelopedMarkets extends Rule<Settings> {developedMarketsValueInBaseCurrency: number) {super(exchangeRateDataService, {- key: AllocationClusterRiskDevelopedMarkets.name,+ key: EconomicMarketClusterRiskDevelopedMarkets.name,name: 'Developed Markets'});diff --git a/apps/api/src/models/rules/allocation-cluster-risk/emerging-markets.ts b/apps/api/src/models/rules/economic-market-cluster-risk/emerging-markets.tssimilarity index 95%rename from apps/api/src/models/rules/allocation-cluster-risk/emerging-markets.tsrename to apps/api/src/models/rules/economic-market-cluster-risk/emerging-markets.tsindex e7c1075108..8fccdf1d84 100644--- a/apps/api/src/models/rules/allocation-cluster-risk/emerging-markets.ts+++ b/apps/api/src/models/rules/economic-market-cluster-risk/emerging-markets.ts@@ -3,7 +3,7 @@ import { Rule } from '@ghostfolio/api/models/rule';import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';import { UserSettings } from '@ghostfolio/common/interfaces';-export class AllocationClusterRiskEmergingMarkets extends Rule<Settings> {+export class EconomicMarketClusterRiskEmergingMarkets extends Rule<Settings> {private currentValueInBaseCurrency: number;private emergingMarketsValueInBaseCurrency: number;@@ -13,7 +13,7 @@ export class AllocationClusterRiskEmergingMarkets extends Rule<Settings> {emergingMarketsValueInBaseCurrency: number) {super(exchangeRateDataService, {- key: AllocationClusterRiskEmergingMarkets.name,+ key: EconomicMarketClusterRiskEmergingMarkets.name,name: 'Emerging Markets'});diff --git a/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts b/apps/client/src/app/pages/portfolio/fire/fire-page.component.tsindex ea83500c49..d20c66912c 100644--- a/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts+++ b/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts@@ -22,9 +22,9 @@ import { takeUntil } from 'rxjs/operators';})export class FirePageComponent implements OnDestroy, OnInit {public accountClusterRiskRules: PortfolioReportRule[];- public allocationClusterRiskRules: PortfolioReportRule[];public currencyClusterRiskRules: PortfolioReportRule[];public deviceType: string;+ public economicMarketClusterRiskRules: PortfolioReportRule[];public emergencyFundRules: PortfolioReportRule[];public feeRules: PortfolioReportRule[];public fireWealth: Big;@@ -204,15 +204,15 @@ export class FirePageComponent implements OnDestroy, OnInit {}) ?? null;- this.allocationClusterRiskRules =- portfolioReport.rules['allocationClusterRisk']?.filter(+ this.currencyClusterRiskRules =+ portfolioReport.rules['currencyClusterRisk']?.filter(({ isActive }) => {return isActive;}) ?? null;- this.currencyClusterRiskRules =- portfolioReport.rules['currencyClusterRisk']?.filter(+ this.economicMarketClusterRiskRules =+ portfolioReport.rules['economicMarketClusterRisk']?.filter(({ isActive }) => {return isActive;}diff --git a/apps/client/src/app/pages/portfolio/fire/fire-page.html b/apps/client/src/app/pages/portfolio/fire/fire-page.htmlindex 4eedca3001..7a336b62f7 100644--- a/apps/client/src/app/pages/portfolio/fire/fire-page.html+++ b/apps/client/src/app/pages/portfolio/fire/fire-page.html@@ -176,7 +176,7 @@</div><div class="mb-4"><h4 class="align-items-center d-flex m-0">- <span i18n>Allocation Cluster Risks</span>+ <span i18n>Economic Market Cluster Risks</span>@if (user?.subscription?.type === 'Basic') {<gf-premium-indicator class="ml-1" />}@@ -188,7 +188,7 @@user?.settings?.isExperimentalFeatures"[isLoading]="isLoadingPortfolioReport"- [rules]="allocationClusterRiskRules"+ [rules]="economicMarketClusterRiskRules"[settings]="user?.settings?.xRayRules"(rulesUpdated)="onRulesUpdated($event)"/>diff --git a/libs/common/src/lib/interfaces/x-ray-rules-settings.interface.ts b/libs/common/src/lib/interfaces/x-ray-rules-settings.interface.tsindex f38a8e6a99..579d589b61 100644--- a/libs/common/src/lib/interfaces/x-ray-rules-settings.interface.ts+++ b/libs/common/src/lib/interfaces/x-ray-rules-settings.interface.ts@@ -1,10 +1,10 @@export interface XRayRulesSettings {AccountClusterRiskCurrentInvestment?: RuleSettings;AccountClusterRiskSingleAccount?: RuleSettings;- AllocationClusterRiskDevelopedMarkets?: RuleSettings;- AllocationClusterRiskEmergingMarkets?: RuleSettings;CurrencyClusterRiskBaseCurrencyCurrentInvestment?: RuleSettings;CurrencyClusterRiskCurrentInvestment?: RuleSettings;+ EconomicMarketClusterRiskDevelopedMarkets?: RuleSettings;+ EconomicMarketClusterRiskEmergingMarkets?: RuleSettings;EmergencyFundSetup?: RuleSettings;FeeRatioInitialInvestment?: RuleSettings;}