Browse Source

Merge branch 'main' into task/improve-usability-of-asset-profile-details-dialog-for-currencies

pull/6406/head
Thomas Kaul 2 days ago
committed by GitHub
parent
commit
a9e104603c
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 8
      apps/api/src/app/portfolio/portfolio.service.ts
  3. 8
      apps/api/src/app/user/user.service.ts
  4. 104
      apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts
  5. 9
      apps/client/src/app/pages/i18n/i18n-page.html
  6. 1
      libs/common/src/lib/interfaces/x-ray-rules-settings.interface.ts

1
CHANGELOG.md

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Improved the usability of the asset profile details dialog in the admin control panel for currencies
- Removed the deprecated static portfolio analysis rule: _Fees_ (Fee Ratio)
### Fixed

8
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,

8
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,

104
apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts

@ -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;
}

9
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

1
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;

Loading…
Cancel
Save