Эх сурвалжийг харах

先来个治标不治本的方法,下周试试把通道移除掉,可能是这货带来的bug。

skyffire 1 жил өмнө
parent
commit
a78db53971
1 өөрчлөгдсөн 12 нэмэгдсэн , 4 устгасан
  1. 12 4
      strategy/src/strategy.rs

+ 12 - 4
strategy/src/strategy.rs

@@ -1180,7 +1180,9 @@ impl Strategy {
                     ];
 
                     // debug!(?order);
-                    command.limits_open.insert(client_id, order);
+                    if command.limits_open.is_empty() {
+                        command.limits_open.insert(client_id, order);
+                    }
                 }
             }
         }
@@ -1208,7 +1210,9 @@ impl Strategy {
                     ];
 
                     // debug!(?order);
-                    command.limits_open.insert(client_id, order);
+                    if command.limits_open.is_empty() {
+                        command.limits_open.insert(client_id, order);
+                    }
                 }
             }
         }
@@ -1271,8 +1275,12 @@ impl Strategy {
 
         // 下单指令处理逻辑
         self._cancel_open(&mut command, local_orders);              // 撤单命令处理
-        self._post_open(&mut command, local_orders);                // 限价单命令处理
-        self._post_close(&mut command, local_orders);               // 平仓单命令处理
+        if command.cancel.is_empty(){
+            self._post_close(&mut command, local_orders);               // 平仓单命令处理
+            if command.limits_close.is_empty() {
+                self._post_open(&mut command, local_orders);                // 限价单命令处理
+            }
+        }
 
         self._check_local_orders(&mut command, local_orders);       // 固定时间检查超时订单
         self._update_in_cancel(&mut command, local_orders);         // 更新撤单队列,是一个filter