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