Browse Source

Feature/rename allocation cluster risk x ray rule (#3994)

* Rename Allocation Cluster Risk to Economic Market Cluster Risk

* Update changelog
pull/3996/head
Thomas Kaul 3 months ago
committed by GitHub
parent
commit
5de176a7ef
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 9
      CHANGELOG.md
  2. 10
      apps/api/src/app/portfolio/portfolio.service.ts
  3. 12
      apps/api/src/app/user/user.service.ts
  4. 4
      apps/api/src/models/rules/economic-market-cluster-risk/developed-markets.ts
  5. 4
      apps/api/src/models/rules/economic-market-cluster-risk/emerging-markets.ts
  6. 10
      apps/client/src/app/pages/portfolio/fire/fire-page.component.ts
  7. 4
      apps/client/src/app/pages/portfolio/fire/fire-page.html
  8. 4
      libs/common/src/lib/interfaces/x-ray-rules-settings.interface.ts

9
CHANGELOG.md

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Restructured the resources page - 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`) - Improved the language localization for German (`de`)
- Switched the `consistent-generic-constructors` rule from `warn` to `error` in the `eslint` configuration - 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 - 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 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 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 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_ (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_ (Emerging Markets)
## 2.118.0 - 2024-10-23 ## 2.118.0 - 2024-10-23
### Added ### Added
- Added a new static portfolio analysis rule: Allocation Cluster Risk (Developed 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 a new static portfolio analysis rule: _Allocation Cluster Risk_ (Emerging Markets)
- Added support for mutual funds in the _EOD Historical Data_ service - Added support for mutual funds in the _EOD Historical Data_ service
### Changed ### Changed

10
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 { getFactor } from '@ghostfolio/api/helper/portfolio.helper';
import { AccountClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/account-cluster-risk/current-investment'; 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 { 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 { 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 { 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 { EmergencyFundSetup } from '@ghostfolio/api/models/rules/emergency-fund/emergency-fund-setup';
import { FeeRatioInitialInvestment } from '@ghostfolio/api/models/rules/fees/fee-ratio-initial-investment'; import { FeeRatioInitialInvestment } from '@ghostfolio/api/models/rules/fees/fee-ratio-initial-investment';
import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service';
@ -1193,16 +1193,16 @@ export class PortfolioService {
userSettings userSettings
) )
: undefined, : undefined,
allocationClusterRisk: economicMarketClusterRisk:
summary.ordersCount > 0 summary.ordersCount > 0
? await this.rulesService.evaluate( ? await this.rulesService.evaluate(
[ [
new AllocationClusterRiskDevelopedMarkets( new EconomicMarketClusterRiskDevelopedMarkets(
this.exchangeRateDataService, this.exchangeRateDataService,
marketsTotalInBaseCurrency, marketsTotalInBaseCurrency,
markets.developedMarkets.valueInBaseCurrency markets.developedMarkets.valueInBaseCurrency
), ),
new AllocationClusterRiskEmergingMarkets( new EconomicMarketClusterRiskEmergingMarkets(
this.exchangeRateDataService, this.exchangeRateDataService,
marketsTotalInBaseCurrency, marketsTotalInBaseCurrency,
markets.emergingMarkets.valueInBaseCurrency markets.emergingMarkets.valueInBaseCurrency

12
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 { PortfolioChangedEvent } from '@ghostfolio/api/events/portfolio-changed.event';
import { AccountClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/account-cluster-risk/current-investment'; 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 { 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 { 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 { 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 { EmergencyFundSetup } from '@ghostfolio/api/models/rules/emergency-fund/emergency-fund-setup';
import { FeeRatioInitialInvestment } from '@ghostfolio/api/models/rules/fees/fee-ratio-initial-investment'; import { FeeRatioInitialInvestment } from '@ghostfolio/api/models/rules/fees/fee-ratio-initial-investment';
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
@ -217,14 +217,14 @@ export class UserService {
undefined, undefined,
{} {}
).getSettings(user.Settings.settings), ).getSettings(user.Settings.settings),
AllocationClusterRiskDevelopedMarkets: EconomicMarketClusterRiskDevelopedMarkets:
new AllocationClusterRiskDevelopedMarkets( new EconomicMarketClusterRiskDevelopedMarkets(
undefined, undefined,
undefined, undefined,
undefined undefined
).getSettings(user.Settings.settings), ).getSettings(user.Settings.settings),
AllocationClusterRiskEmergingMarkets: EconomicMarketClusterRiskEmergingMarkets:
new AllocationClusterRiskEmergingMarkets( new EconomicMarketClusterRiskEmergingMarkets(
undefined, undefined,
undefined, undefined,
undefined undefined

4
apps/api/src/models/rules/allocation-cluster-risk/developed-markets.ts → 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 { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';
import { UserSettings } from '@ghostfolio/common/interfaces'; import { UserSettings } from '@ghostfolio/common/interfaces';
export class AllocationClusterRiskDevelopedMarkets extends Rule<Settings> { export class EconomicMarketClusterRiskDevelopedMarkets extends Rule<Settings> {
private currentValueInBaseCurrency: number; private currentValueInBaseCurrency: number;
private developedMarketsValueInBaseCurrency: number; private developedMarketsValueInBaseCurrency: number;
@ -13,7 +13,7 @@ export class AllocationClusterRiskDevelopedMarkets extends Rule<Settings> {
developedMarketsValueInBaseCurrency: number developedMarketsValueInBaseCurrency: number
) { ) {
super(exchangeRateDataService, { super(exchangeRateDataService, {
key: AllocationClusterRiskDevelopedMarkets.name, key: EconomicMarketClusterRiskDevelopedMarkets.name,
name: 'Developed Markets' name: 'Developed Markets'
}); });

4
apps/api/src/models/rules/allocation-cluster-risk/emerging-markets.ts → 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 { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';
import { UserSettings } from '@ghostfolio/common/interfaces'; import { UserSettings } from '@ghostfolio/common/interfaces';
export class AllocationClusterRiskEmergingMarkets extends Rule<Settings> { export class EconomicMarketClusterRiskEmergingMarkets extends Rule<Settings> {
private currentValueInBaseCurrency: number; private currentValueInBaseCurrency: number;
private emergingMarketsValueInBaseCurrency: number; private emergingMarketsValueInBaseCurrency: number;
@ -13,7 +13,7 @@ export class AllocationClusterRiskEmergingMarkets extends Rule<Settings> {
emergingMarketsValueInBaseCurrency: number emergingMarketsValueInBaseCurrency: number
) { ) {
super(exchangeRateDataService, { super(exchangeRateDataService, {
key: AllocationClusterRiskEmergingMarkets.name, key: EconomicMarketClusterRiskEmergingMarkets.name,
name: 'Emerging Markets' name: 'Emerging Markets'
}); });

10
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 { export class FirePageComponent implements OnDestroy, OnInit {
public accountClusterRiskRules: PortfolioReportRule[]; public accountClusterRiskRules: PortfolioReportRule[];
public allocationClusterRiskRules: PortfolioReportRule[];
public currencyClusterRiskRules: PortfolioReportRule[]; public currencyClusterRiskRules: PortfolioReportRule[];
public deviceType: string; public deviceType: string;
public economicMarketClusterRiskRules: PortfolioReportRule[];
public emergencyFundRules: PortfolioReportRule[]; public emergencyFundRules: PortfolioReportRule[];
public feeRules: PortfolioReportRule[]; public feeRules: PortfolioReportRule[];
public fireWealth: Big; public fireWealth: Big;
@ -204,15 +204,15 @@ export class FirePageComponent implements OnDestroy, OnInit {
} }
) ?? null; ) ?? null;
this.allocationClusterRiskRules = this.currencyClusterRiskRules =
portfolioReport.rules['allocationClusterRisk']?.filter( portfolioReport.rules['currencyClusterRisk']?.filter(
({ isActive }) => { ({ isActive }) => {
return isActive; return isActive;
} }
) ?? null; ) ?? null;
this.currencyClusterRiskRules = this.economicMarketClusterRiskRules =
portfolioReport.rules['currencyClusterRisk']?.filter( portfolioReport.rules['economicMarketClusterRisk']?.filter(
({ isActive }) => { ({ isActive }) => {
return isActive; return isActive;
} }

4
apps/client/src/app/pages/portfolio/fire/fire-page.html

@ -176,7 +176,7 @@
</div> </div>
<div class="mb-4"> <div class="mb-4">
<h4 class="align-items-center d-flex m-0"> <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') { @if (user?.subscription?.type === 'Basic') {
<gf-premium-indicator class="ml-1" /> <gf-premium-indicator class="ml-1" />
} }
@ -188,7 +188,7 @@
user?.settings?.isExperimentalFeatures user?.settings?.isExperimentalFeatures
" "
[isLoading]="isLoadingPortfolioReport" [isLoading]="isLoadingPortfolioReport"
[rules]="allocationClusterRiskRules" [rules]="economicMarketClusterRiskRules"
[settings]="user?.settings?.xRayRules" [settings]="user?.settings?.xRayRules"
(rulesUpdated)="onRulesUpdated($event)" (rulesUpdated)="onRulesUpdated($event)"
/> />

4
libs/common/src/lib/interfaces/x-ray-rules-settings.interface.ts

@ -1,10 +1,10 @@
export interface XRayRulesSettings { export interface XRayRulesSettings {
AccountClusterRiskCurrentInvestment?: RuleSettings; AccountClusterRiskCurrentInvestment?: RuleSettings;
AccountClusterRiskSingleAccount?: RuleSettings; AccountClusterRiskSingleAccount?: RuleSettings;
AllocationClusterRiskDevelopedMarkets?: RuleSettings;
AllocationClusterRiskEmergingMarkets?: RuleSettings;
CurrencyClusterRiskBaseCurrencyCurrentInvestment?: RuleSettings; CurrencyClusterRiskBaseCurrencyCurrentInvestment?: RuleSettings;
CurrencyClusterRiskCurrentInvestment?: RuleSettings; CurrencyClusterRiskCurrentInvestment?: RuleSettings;
EconomicMarketClusterRiskDevelopedMarkets?: RuleSettings;
EconomicMarketClusterRiskEmergingMarkets?: RuleSettings;
EmergencyFundSetup?: RuleSettings; EmergencyFundSetup?: RuleSettings;
FeeRatioInitialInvestment?: RuleSettings; FeeRatioInitialInvestment?: RuleSettings;
} }

Loading…
Cancel
Save