Răsfoiți Sursa

coinex rest撤单成功直接remove

JiahengHe 1 an în urmă
părinte
comite
087e5536bf
1 a modificat fișierele cu 7 adăugiri și 4 ștergeri
  1. 7 4
      standard/src/coinex_swap.rs

+ 7 - 4
standard/src/coinex_swap.rs

@@ -510,7 +510,7 @@ impl Platform for CoinexSwap {
                     avg_price: Default::default(),
                     status: "NULL".to_string(),
                     order_type: "".to_string(),
-                    trace_stack:  TraceStack::new(0, Instant::now()).on_special("485 coinex_swap".to_string())
+                    trace_stack:  TraceStack::new(0, Instant::now()).on_special("513 coinex_swap".to_string())
                 };
             } else {
                 result = format_order_item(res_data_json, ct_val, "canceled");
@@ -643,8 +643,11 @@ impl Platform for CoinexSwap {
             let handle = spawn(async move {
                 let result = self_clone.cancel_order(&order_id, &custom_id).await;
                 match result {
-                    Ok(_) => {
-                        // self_clone.order_sender.send(order).await.unwrap();
+                    Ok(order) => {
+                        if order.status == "REMOVE" {
+                            // 由于有时撤单成功ws不推送,所以加入rest
+                            self_clone.order_sender.send(order).await.unwrap();
+                        }
                     }
                     Err(error) => {
                         // info!("撤单失败:{:?}", error.to_string());
@@ -762,7 +765,7 @@ pub fn format_order_item(order: Value, ct_val: Decimal, status: &str) -> Order {
         avg_price,
         status: custom_status,
         order_type: "limit".to_string(),
-        trace_stack: TraceStack::new(0, Instant::now()).on_special("688 trace_stack".to_string()),
+        trace_stack: TraceStack::new(0, Instant::now()).on_special("765 trace_stack".to_string()),
     };
     return rst_order;
 }