skyfffire 1 ano atrás
pai
commit
ab4ee8aff9
1 arquivos alterados com 21 adições e 23 exclusões
  1. 21 23
      exchanges/tests/binance_swap_test.rs

+ 21 - 23
exchanges/tests/binance_swap_test.rs

@@ -20,7 +20,6 @@ async fn ws_custom_subscribe() {
     global::log_utils::init_log_with_trace();
 
 
-    let tcc = tokio::spawn(async move {
         let (write_tx, write_rx) = futures_channel::mpsc::unbounded();
         let (_, mut read_rx) = futures_channel::mpsc::unbounded::<ResponseData>();
 
@@ -80,16 +79,16 @@ async fn ws_custom_subscribe() {
             api_secret: SECRET_KEY.to_string(),
         };
         let t1 = tokio::spawn(async move {
-            let mut ws = get_ws(Option::from(param), BinanceSwapWsType::Private).await;
+            let mut ws = get_ws(Option::from(param), BinanceSwapWsType::Public).await;
             ws.set_symbols(vec!["BTC_USDT".to_string(), "ETC_USDT".to_string()]);
             ws.set_subscribe(vec![
                 // BinanceSwapSubscribeType::PuBookTicker,
-                // BinanceSwapSubscribeType::PuAggTrade,
+                BinanceSwapSubscribeType::PuAggTrade,
                 // BinanceSwapSubscribeType::PuDepth20levels100ms,
 
-                BinanceSwapSubscribeType::PrAccount,
-                BinanceSwapSubscribeType::PrBalance,
-                BinanceSwapSubscribeType::PrPosition
+                // BinanceSwapSubscribeType::PrAccount,
+                // BinanceSwapSubscribeType::PrBalance,
+                // BinanceSwapSubscribeType::PrPosition
             ]);
             //链接
             let bool_v3_clone = Arc::clone(&is_shutdown_arc);
@@ -101,24 +100,23 @@ async fn ws_custom_subscribe() {
         trace!("重启!");
         trace!("参考交易所关闭");
         return;
-    });
 
-
-    tokio::time::sleep(Duration::from_millis(10 * 1000)).await;
-    let mut rest = get_rest();
-    let ttt = chrono::Utc::now().timestamp_millis() + 6000000;
-    let rep_data = rest.swap_order(json!({
-          "symbol":"CFXUSDT",
-          "side":"BUY",
-          "positionSide":"LONG",
-          "type":"LIMIT",
-          "quantity":50,
-          "price":0.11,
-          "timeInForce":"GTD",
-         "goodtilldate":ttt
-    })).await;
-    trace!(?rep_data);
-    trace!("1111111111");
+    //
+    // tokio::time::sleep(Duration::from_millis(10 * 1000)).await;
+    // let mut rest = get_rest();
+    // let ttt = chrono::Utc::now().timestamp_millis() + 6000000;
+    // let rep_data = rest.swap_order(json!({
+    //       "symbol":"CFXUSDT",
+    //       "side":"BUY",
+    //       "positionSide":"LONG",
+    //       "type":"LIMIT",
+    //       "quantity":50,
+    //       "price":0.11,
+    //       "timeInForce":"GTD",
+    //      "goodtilldate":ttt
+    // })).await;
+    // trace!(?rep_data);
+    // trace!("1111111111");
 }
 
 //rest-获取服务器时间