Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/remove deprecated fee ratio X-ray rule (#6364)

Thomas Kaula7434c9ba7cc
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 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_ page
diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts
index 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/rul
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 { 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.ts
index 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/rul
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 { 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.ts
deleted file mode 100644
index 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.html
index 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 $&#123;thresholdMax&#125;% of your initial investment
- ($&#123;feeRatio&#125;%)
- </li>
- <li i18n="@@rule.feeRatioInitialInvestment.true">
- The fees do not exceed $&#123;thresholdMax&#125;% of your initial
- investment ($&#123;feeRatio&#125;%)
- </li>
<li i18n="@@rule.feeRatioTotalInvestmentVolume">Fee Ratio</li>
<li i18n="@@rule.feeRatioTotalInvestmentVolume.false">
The fees do exceed $&#123;thresholdMax&#125;% of your total investment
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.ts
index 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;