Browse Source

撤单逻辑

skyffire 9 months ago
parent
commit
55c847395e
1 changed files with 14 additions and 12 deletions
  1. 14 12
      strategy/src/core.rs

+ 14 - 12
strategy/src/core.rs

@@ -618,18 +618,20 @@ impl Core {
         self.predictor.on_trade(trade, index).await;
 
         // 产生交易信号
-        let mut orders = self.strategy.do_strategy(&mut self.predictor, &self.local_orders, &self.local_position, &self.local_coin, &self.local_cash);
-        trace_stack.on_after_strategy();
-
-        if orders.is_not_empty() {
-            let mut platform_rest_fb = self.platform_rest.clone_box();
-            // 先更新本地记录再发单。
-            self._update_local_orders(&mut orders);
-            // info!("订单指令:{:?}", orders);
-            let mut ts = trace_stack.clone();
-            spawn(async move {
-                platform_rest_fb.command_order(&mut orders, &mut ts).await;
-            });
+        if trade.value > Decimal::ONE_HUNDRED {
+            let mut orders = self.strategy.do_strategy(&mut self.predictor, &self.local_orders, &self.local_position, &self.local_coin, &self.local_cash);
+            trace_stack.on_after_strategy();
+
+            if orders.is_not_empty() {
+                let mut platform_rest_fb = self.platform_rest.clone_box();
+                // 先更新本地记录再发单。
+                self._update_local_orders(&mut orders);
+                // info!("订单指令:{:?}", orders);
+                let mut ts = trace_stack.clone();
+                spawn(async move {
+                    platform_rest_fb.command_order(&mut orders, &mut ts).await;
+                });
+            }
         }
     }