Sfoglia il codice sorgente

止损数据调整

skyffire 10 mesi fa
parent
commit
e5a270ca96
1 ha cambiato i file con 6 aggiunte e 10 eliminazioni
  1. 6 10
      strategy/src/predictor.rs

+ 6 - 10
strategy/src/predictor.rs

@@ -226,16 +226,12 @@ impl Predictor {
                     (self.pos_avg_price - self.mid_price) / self.pos_avg_price
                 };
 
-                let mul = Decimal::from(self.profit_fixed_vec.len());
-                self.profit_fixed_vec.push(profit_now * mul);
+                let mul = Decimal::ONE_HUNDRED * (Decimal::ONE - self.t_diff);
+                // self.profit_fixed_vec.push();
 
-                let total: Decimal = self.profit_fixed_vec.iter().sum();
-                self.profit_point = if total > Decimal::ZERO {
-                    (total + Decimal::ONE).ln()
-                } else {
-                    -(total.abs() + Decimal::ONE).ln()
-                };
-                self.profit_point_ema = self.profit_point_ema * dec!(0.995) + self.profit_point * dec!(0.005);
+                // let total: Decimal = self.profit_fixed_vec.iter().sum();
+                self.profit_point = profit_now * mul;
+                self.profit_point_ema = self.profit_point_ema * dec!(0.99) + self.profit_point * dec!(0.01);
             }
         }
 
@@ -503,7 +499,7 @@ impl Predictor {
             }
 
             // ============================ 止损逻辑处理 =======================
-            if self.fair_rate_focus_close.is_zero() && !self.inventory.is_zero() && self.profit_point < dec!(-6) {
+            if self.fair_rate_focus_close.is_zero() && !self.inventory.is_zero() && self.profit_point < dec!(-0.05) {
                 self.fair_rate_focus_close = dec!(-0.0314159);
                 self.fair_price_focus_close = self.mid_price;