Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Task/remove deprecated fee ratio X-ray rule (#6364)
Thomas Kaula7434c9ba7cc
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6b1a1c9780..0b25ff7e6c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## Unreleased+### Changed++- Removed the deprecated static portfolio analysis rule: _Fees_ (Fee Ratio)+### Fixed- Fixed an exception by adding a fallback for missing market price values on the _X-ray_ pagediff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.tsindex b96f5ef700..17bd01ce48 100644--- a/apps/api/src/app/portfolio/portfolio.service.ts+++ b/apps/api/src/app/portfolio/portfolio.service.ts@@ -13,7 +13,6 @@ import { CurrencyClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rulimport { 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 { FeeRatioTotalInvestmentVolume } from '@ghostfolio/api/models/rules/fees/fee-ratio-total-investment-volume';import { BuyingPower } from '@ghostfolio/api/models/rules/liquidity/buying-power';import { RegionalMarketClusterRiskAsiaPacific } from '@ghostfolio/api/models/rules/regional-market-cluster-risk/asia-pacific';@@ -1310,13 +1309,6 @@ export class PortfolioService {}),rules: await this.rulesService.evaluate([- new FeeRatioInitialInvestment(- this.exchangeRateDataService,- this.i18nService,- userSettings.language,- summary.committedFunds,- summary.fees- ),new FeeRatioTotalInvestmentVolume(this.exchangeRateDataService,this.i18nService,diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.tsindex 08328851dd..97ab8a59f4 100644--- a/apps/api/src/app/user/user.service.ts+++ b/apps/api/src/app/user/user.service.ts@@ -12,7 +12,6 @@ import { CurrencyClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rulimport { 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 { FeeRatioTotalInvestmentVolume } from '@ghostfolio/api/models/rules/fees/fee-ratio-total-investment-volume';import { BuyingPower } from '@ghostfolio/api/models/rules/liquidity/buying-power';import { RegionalMarketClusterRiskAsiaPacific } from '@ghostfolio/api/models/rules/regional-market-cluster-risk/asia-pacific';@@ -377,13 +376,6 @@ export class UserService {undefined,undefined).getSettings(user.settings.settings),- FeeRatioInitialInvestment: new FeeRatioInitialInvestment(- undefined,- undefined,- undefined,- undefined,- undefined- ).getSettings(user.settings.settings),FeeRatioTotalInvestmentVolume: new FeeRatioTotalInvestmentVolume(undefined,undefined,diff --git a/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts b/apps/api/src/models/rules/fees/fee-ratio-initial-investment.tsdeleted file mode 100644index 54c2decc90..0000000000--- a/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts+++ /dev/null@@ -1,104 +0,0 @@-import { Rule } from '@ghostfolio/api/models/rule';-import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';-import { I18nService } from '@ghostfolio/api/services/i18n/i18n.service';-import { RuleSettings, UserSettings } from '@ghostfolio/common/interfaces';--/**- * @deprecated This rule is deprecated in favor of FeeRatioTotalInvestmentVolume- */-export class FeeRatioInitialInvestment extends Rule<Settings> {- private fees: number;- private totalInvestment: number;-- public constructor(- protected exchangeRateDataService: ExchangeRateDataService,- private i18nService: I18nService,- languageCode: string,- totalInvestment: number,- fees: number- ) {- super(exchangeRateDataService, {- languageCode,- key: FeeRatioInitialInvestment.name- });-- this.fees = fees;- this.totalInvestment = totalInvestment;- }-- public evaluate(ruleSettings: Settings) {- const feeRatio = this.totalInvestment- ? this.fees / this.totalInvestment- : 0;-- if (feeRatio > ruleSettings.thresholdMax) {- return {- evaluation: this.i18nService.getTranslation({- id: 'rule.feeRatioInitialInvestment.false',- languageCode: this.getLanguageCode(),- placeholders: {- feeRatio: (ruleSettings.thresholdMax * 100).toFixed(2),- thresholdMax: (feeRatio * 100).toPrecision(3)- }- }),- value: false- };- }-- return {- evaluation: this.i18nService.getTranslation({- id: 'rule.feeRatioInitialInvestment.true',- languageCode: this.getLanguageCode(),- placeholders: {- feeRatio: (feeRatio * 100).toPrecision(3),- thresholdMax: (ruleSettings.thresholdMax * 100).toFixed(2)- }- }),- value: true- };- }-- public getCategoryName() {- return this.i18nService.getTranslation({- id: 'rule.fees.category',- languageCode: this.getLanguageCode()- });- }-- public getConfiguration() {- return {- threshold: {- max: 0.1,- min: 0,- step: 0.0025,- unit: '%'- },- thresholdMax: true- };- }-- public getName() {- return this.i18nService.getTranslation({- id: 'rule.feeRatioInitialInvestment',- languageCode: this.getLanguageCode()- });- }-- public getSettings({- baseCurrency,- locale,- xRayRules- }: UserSettings): Settings {- return {- baseCurrency,- locale,- isActive: xRayRules?.[this.getKey()]?.isActive ?? true,- thresholdMax: xRayRules?.[this.getKey()]?.thresholdMax ?? 0.01- };- }-}--interface Settings extends RuleSettings {- baseCurrency: string;- thresholdMax: number;-}diff --git a/apps/client/src/app/pages/i18n/i18n-page.html b/apps/client/src/app/pages/i18n/i18n-page.htmlindex a8797c07a2..99ef3039ea 100644--- a/apps/client/src/app/pages/i18n/i18n-page.html+++ b/apps/client/src/app/pages/i18n/i18n-page.html@@ -149,15 +149,6 @@<li i18n="@@rule.emergencyFundSetup.true">An emergency fund has been set up</li>- <li i18n="@@rule.feeRatioInitialInvestment">Fee Ratio (legacy)</li>- <li i18n="@@rule.feeRatioInitialInvestment.false">- The fees do exceed ${thresholdMax}% of your initial investment- (${feeRatio}%)- </li>- <li i18n="@@rule.feeRatioInitialInvestment.true">- The fees do not exceed ${thresholdMax}% of your initial- investment (${feeRatio}%)- </li><li i18n="@@rule.feeRatioTotalInvestmentVolume">Fee Ratio</li><li i18n="@@rule.feeRatioTotalInvestmentVolume.false">The fees do exceed ${thresholdMax}% of your total investmentdiff --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 688d4f2a0b..60a76d4685 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@@ -9,7 +9,6 @@ export interface XRayRulesSettings {EconomicMarketClusterRiskDevelopedMarkets?: RuleSettings;EconomicMarketClusterRiskEmergingMarkets?: RuleSettings;EmergencyFundSetup?: RuleSettings;- FeeRatioInitialInvestment?: RuleSettings;FeeRatioTotalInvestmentVolume?: RuleSettings;RegionalMarketClusterRiskAsiaPacific?: RuleSettings;RegionalMarketClusterRiskEmergingMarkets?: RuleSettings;