Browse Source

防止连续开单

skyffire 8 months ago
parent
commit
50b6605d0c
1 changed files with 5 additions and 1 deletions
  1. 5 1
      strategy/src/predictor.rs

+ 5 - 1
strategy/src/predictor.rs

@@ -306,10 +306,14 @@ impl Predictor {
             self.trade_condition = Decimal::ZERO;
             self.trade_condition_time = Decimal::ZERO;
 
-            // 开
+            // 开
             if prev_pos_amount.is_zero() {
                 self.prev_open_time = Decimal::from(Utc::now().timestamp_millis())
             }
+            // 平仓
+            if self.pos_amount.is_zero() {
+                self.mid_price_short_vec.deque.clear();
+            }
 
             self.processor(update_time, true).await;
         }