diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d11c5314..aaaa0e4a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Removed the deprecated static portfolio analysis rule: _Fees_ (Fee Ratio) - Refactored queries in the data provider service to use Prisma’s type-safe methods ### Fixed diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index b96f5ef70..17bd01ce4 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 08328851d..97ab8a59f 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 54c2decc9..000000000 --- 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 { - 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 a8797c07a..99ef3039e 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 @@
  • An emergency fund has been set up
  • -
  • Fee Ratio (legacy)
  • -
  • - The fees do exceed ${thresholdMax}% of your initial investment - (${feeRatio}%) -
  • -
  • - The fees do not exceed ${thresholdMax}% of your initial - investment (${feeRatio}%) -
  • Fee Ratio
  • The fees do exceed ${thresholdMax}% 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 688d4f2a0..60a76d468 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;