Browse Source

防止连续开单

skyffire 8 tháng trước cách đây
mục cha
commit
50b6605d0c
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  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;
         }