skyffire 1 жил өмнө
parent
commit
b87d42e411
1 өөрчлөгдсөн 9 нэмэгдсэн , 13 устгасан
  1. 9 13
      src/rank.rs

+ 9 - 13
src/rank.rs

@@ -28,7 +28,7 @@ pub struct Rank {
 const ONE_QUARTER: Decimal = dec!(0.25);
 const ONE_PERCENT: Decimal = dec!(0.01);
 const TWENTY: Decimal = dec!(20);
-const SIXTY: Decimal = dec!(60);
+// const SIXTY: Decimal = dec!(60);
 const TWO_HUNDRED: Decimal = dec!(200);
 // const TEN_THOUSAND: Decimal = dec!(10000);
 
@@ -77,24 +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;
+        // 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;
+            // 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
-        };
+        // let epr_avg = if epr_count == Decimal::ZERO {
+        //     epr_total
+        // } else {
+        //     epr_total / epr_count
+        // };
 
         // ============== liq相关数据的计算 =================
         let mut liquidity_total = Decimal::ZERO;
@@ -111,11 +111,7 @@ 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_avg * SIXTY).powd(Decimal::TWO)
-            } else {
-                (epr_avg * SIXTY * (epr_total / msv_abs_total)).powd(Decimal::TWO)
-            }
+            epr_total * (epr_total / msv_abs_total)
         } else {
             Decimal::ZERO
         };