|
|
@@ -77,17 +77,24 @@ pub fn generate_rank_by_indicator_map(indicator_map: &MutexGuard<HashMap<String,
|
|
|
// ============== epr相关数据的计算 =================
|
|
|
let mut epr_total = Decimal::ZERO;
|
|
|
let mut epr_max = Decimal::ZERO;
|
|
|
+ let mut epr_count = Decimal::ZERO;
|
|
|
for value in indicators.eprs.iter() {
|
|
|
if value[1].abs() < ONE_PERCENT {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
epr_total += value[1];
|
|
|
+ epr_count += Decimal::ONE;
|
|
|
|
|
|
if value[1] > epr_max {
|
|
|
epr_max = value[1]
|
|
|
}
|
|
|
}
|
|
|
+ let epr_avg = if epr_count == Decimal::ZERO {
|
|
|
+ epr_total
|
|
|
+ } else {
|
|
|
+ epr_total / epr_count
|
|
|
+ };
|
|
|
|
|
|
// ============== liq相关数据的计算 =================
|
|
|
let mut liquidity_total = Decimal::ZERO;
|
|
|
@@ -105,9 +112,9 @@ pub fn generate_rank_by_indicator_map(indicator_map: &MutexGuard<HashMap<String,
|
|
|
// msv_score计算规则
|
|
|
let mut msv_score = if msv_abs_total > Decimal::ZERO && epr_total > Decimal::ZERO {
|
|
|
if epr_total > msv_abs_total {
|
|
|
- (epr_max * SIXTY).powd(Decimal::TWO)
|
|
|
+ (epr_avg * SIXTY).powd(Decimal::TWO)
|
|
|
} else {
|
|
|
- (epr_max * SIXTY * (epr_total / msv_abs_total)).powd(Decimal::TWO)
|
|
|
+ (epr_avg * SIXTY * (epr_total / msv_abs_total)).powd(Decimal::TWO)
|
|
|
}
|
|
|
} else {
|
|
|
Decimal::ZERO
|