hl vor 1 Jahr
Ursprung
Commit
3a96bb5d70
2 geänderte Dateien mit 14 neuen und 8 gelöschten Zeilen
  1. 4 1
      exchanges/src/cointr_swap_ws.rs
  2. 10 7
      exchanges/tests/cointr_swap_test.rs

+ 4 - 1
exchanges/src/cointr_swap_ws.rs

@@ -400,8 +400,11 @@ impl CointrSwapWs {
                         res_data.code = 400;
                         res_data.channel = "未知推送数据".to_string();
                     }
-                    return res_data;
+                }else{
+                    res_data.code = 400;
+                    res_data.channel = format!("{}类型数据",action);
                 }
+                return res_data;
             }
         }
 

+ 10 - 7
exchanges/tests/cointr_swap_test.rs

@@ -7,7 +7,7 @@ use tokio::sync::Mutex;
 use tracing::trace;
 use exchanges::cointr_swap_rest::CointrSwapRest;
 use exchanges::response_base::ResponseData;
-use exchanges::cointr_swap_ws::{CointrSwapLogin,  CointrSwapWs, CointrSwapWsType};
+use exchanges::cointr_swap_ws::{CointrSwapLogin, CointrSwapSubscribeType, CointrSwapWs, CointrSwapWsType};
 
 const ACCESS_KEY: &str = "";
 const SECRET_KEY: &str = "";
@@ -69,7 +69,7 @@ async fn ws_custom_subscribe() {
 
     let fun = move |data: ResponseData| {
         async move {
-            // trace!("---传入的方法~~~~{:?}", data);
+            trace!("---传入的方法~~~~{:?}", data);
         }
     };
     let param = CointrSwapLogin {
@@ -79,11 +79,15 @@ async fn ws_custom_subscribe() {
     };
     let t1 = tokio::spawn(async move {
         let mut ws = get_ws(Option::from(param), CointrSwapWsType::PublicAndPrivate);
-        ws.set_symbols(vec!["ETH_USDT".to_string()]);
+        ws.set_symbols(vec![
+            "BTC_USDT".to_string()
+            // , "ARB_USDT".to_string(),
+            //                  "ETH_USDT".to_string(),
+        ]);
         ws.set_subscribe(vec![
-            // CointrSwapSubscribeType::PuFuturesTrades,
-            // CointrSwapSubscribeType::PuFuturesDepth,
-            // CointrSwapSubscribeType::PuFuturesRecords,
+            CointrSwapSubscribeType::PuFuturesTrades,
+            CointrSwapSubscribeType::PuFuturesDepth,
+            CointrSwapSubscribeType::PuFuturesRecords,
         ]);
         //链接
         let bool_v3_clone = Arc::clone(&is_shutdown_arc);
@@ -103,7 +107,6 @@ fn get_ws(btree_map: Option<CointrSwapLogin>, ws_type: CointrSwapWsType) -> Coin
 }
 
 
-
 //查詢合約基礎信息
 #[tokio::test]
 async fn rest_get_market_test() {