Explorar el Código

撤单后暂停几秒再检查

skyfffire hace 2 semanas
padre
commit
405e6a676b
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      src/strategy.rs

+ 5 - 1
src/strategy.rs

@@ -1,6 +1,7 @@
 use anyhow::Result;
 use rust_decimal::Decimal;
-use std::time::Instant;
+use std::time::{Duration, Instant};
+use tokio::time::{sleep};
 use tracing::info;
 use crate::data_manager::DataManager;
 
@@ -126,6 +127,9 @@ impl Strategy {
 
         self.cancel_order(&order_id).await?;
 
+        // 撤单后暂停几秒再检查
+        sleep(Duration::from_millis(2000)).await;
+
         // 撤单后检查是否有成交
         if self.check_order_partially_filled(&order_id).await? {
             info!("撤单时发现有成交,准备执行市价单");