Sfoglia il codice sorgente

撤单后暂停几秒再检查

skyfffire 2 settimane fa
parent
commit
405e6a676b
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  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!("撤单时发现有成交,准备执行市价单");