|
|
@ -1,6 +1,7 @@ |
|
|
|
import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; |
|
|
|
import { Rule } from '@ghostfolio/api/models/rule'; |
|
|
|
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; |
|
|
|
import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config'; |
|
|
|
import { UserSettings } from '@ghostfolio/common/interfaces'; |
|
|
|
|
|
|
|
export class FeeRatioInitialInvestment extends Rule<Settings> { |
|
|
@ -27,18 +28,30 @@ export class FeeRatioInitialInvestment extends Rule<Settings> { |
|
|
|
: 0; |
|
|
|
|
|
|
|
if (feeRatio > ruleSettings.thresholdMax) { |
|
|
|
const evaluation = this.i18nService |
|
|
|
.getTranslation({ |
|
|
|
id: 'rule.fee-ratio-initial-investment.exceed', |
|
|
|
languageCode: DEFAULT_LANGUAGE_CODE |
|
|
|
}) |
|
|
|
.replace('{thresholdMax}', (ruleSettings.thresholdMax * 100).toFixed(2)) |
|
|
|
.replace('{feeRatio}', (feeRatio * 100).toPrecision(3)); |
|
|
|
|
|
|
|
return { |
|
|
|
evaluation: `The fees do exceed ${ |
|
|
|
ruleSettings.thresholdMax * 100 |
|
|
|
}% of your initial investment (${(feeRatio * 100).toPrecision(3)}%)`,
|
|
|
|
evaluation, |
|
|
|
value: false |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
const evaluation = this.i18nService |
|
|
|
.getTranslation({ |
|
|
|
id: 'rule.fee-ratio-initial-investment.not-exceed', |
|
|
|
languageCode: DEFAULT_LANGUAGE_CODE |
|
|
|
}) |
|
|
|
.replace('{thresholdMax}', (ruleSettings.thresholdMax * 100).toFixed(2)) |
|
|
|
.replace('{feeRatio}', (feeRatio * 100).toPrecision(3)); |
|
|
|
|
|
|
|
return { |
|
|
|
evaluation: `The fees do not exceed ${ |
|
|
|
ruleSettings.thresholdMax * 100 |
|
|
|
}% of your initial investment (${(feeRatio * 100).toPrecision(3)}%)`,
|
|
|
|
evaluation, |
|
|
|
value: true |
|
|
|
}; |
|
|
|
} |
|
|
|