فهرست منبع

coinex 取消订单增加容错

JiahengHe 1 سال پیش
والد
کامیت
f4c78d23d5
1فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 7 1
      standard/src/coinex_swap.rs

+ 7 - 1
standard/src/coinex_swap.rs

@@ -508,7 +508,7 @@ impl Platform for CoinexSwap {
                     amount: Default::default(),
                     deal_amount: Default::default(),
                     avg_price: Default::default(),
-                    status: "NULL".to_string(),
+                    status: "REMOVE".to_string(),
                     order_type: "".to_string(),
                     trace_stack:  TraceStack::new(0, Instant::now()).on_special("485 coinex_swap".to_string())
                 };
@@ -518,6 +518,12 @@ impl Platform for CoinexSwap {
                 result.id = order_id.to_string();
             }
             Ok(result)
+        } else if res_data.code == -1 && res_data.message.contains("3103:order not exists") { // 未成交已取消的订单会报不存在
+            let mut order = Order::new();
+            order.id = order_id.to_string();
+            order.custom_id = custom_id.to_string();
+            order.status = "REMOVE".to_string();
+            Ok(order)
         } else {
             let message = format!("撤单HTTP请求失败  order_id: {}, custom_id: {}, res_data: {:?}", order_id, custom_id, res_data);
             Err(Error::new(ErrorKind::Other, message))