Browse Source

Reordering

pull/3949/head
Thomas Kaul 10 months ago
parent
commit
44c972952e
  1. 18
      apps/api/src/models/rules/allocation-cluster-risk/emerging-markets.ts

18
apps/api/src/models/rules/allocation-cluster-risk/emerging-markets.ts

@ -17,9 +17,9 @@ export class AllocationClusterRiskEmergingMarkets extends Rule<Settings> {
name: 'Emerging Markets' name: 'Emerging Markets'
}); });
this.currentValueInBaseCurrency = currentValueInBaseCurrency;
this.emergingMarketsValueInBaseCurrency = this.emergingMarketsValueInBaseCurrency =
emergingMarketsValueInBaseCurrency; emergingMarketsValueInBaseCurrency;
this.currentValueInBaseCurrency = currentValueInBaseCurrency;
} }
public evaluate(ruleSettings: Settings) { public evaluate(ruleSettings: Settings) {
@ -30,30 +30,26 @@ export class AllocationClusterRiskEmergingMarkets extends Rule<Settings> {
if (emergingMarketsValueRatio > ruleSettings.thresholdMax) { if (emergingMarketsValueRatio > ruleSettings.thresholdMax) {
return { return {
evaluation: `The emerging markets contribution exceeds ${( evaluation: `The emerging markets contribution of your current investment (${(emergingMarketsValueRatio * 100).toPrecision(3)}%) exceeds ${(
ruleSettings.thresholdMax * 100 ruleSettings.thresholdMax * 100
).toPrecision( ).toPrecision(3)}%`,
3
)}% of your current investment (${(emergingMarketsValueRatio * 100).toPrecision(3)}%)`,
value: false value: false
}; };
} else if (emergingMarketsValueRatio < ruleSettings.thresholdMin) { } else if (emergingMarketsValueRatio < ruleSettings.thresholdMin) {
return { return {
evaluation: `The emerging markets contribution is below ${( evaluation: `The emerging markets contribution of your current investment (${(emergingMarketsValueRatio * 100).toPrecision(3)}%) is below ${(
ruleSettings.thresholdMin * 100 ruleSettings.thresholdMin * 100
).toPrecision( ).toPrecision(3)}%`,
3
)}% of your current investment (${(emergingMarketsValueRatio * 100).toPrecision(3)}%)`,
value: false value: false
}; };
} }
return { return {
evaluation: `The emerging markets contribution is within the range of ${( evaluation: `The emerging markets contribution of your current investment (${(emergingMarketsValueRatio * 100).toPrecision(3)}%) is within the range of ${(
ruleSettings.thresholdMin * 100 ruleSettings.thresholdMin * 100
).toPrecision( ).toPrecision(
3 3
)}% and ${(ruleSettings.thresholdMax * 100).toPrecision(3)}% of your current investment (${(emergingMarketsValueRatio * 100).toPrecision(3)}%)`, )}% and ${(ruleSettings.thresholdMax * 100).toPrecision(3)}%`,
value: true value: true
}; };
} }

Loading…
Cancel
Save