Browse Source

新增文件

875428575@qq.com 2 years ago
parent
commit
fb900e53e5

+ 3 - 0
exchanges/src/binance_spot_rest.rs

@@ -0,0 +1,3 @@
+pub struct BinanceSpotWs {}
+
+impl BinanceSpotWs {}

+ 5 - 0
exchanges/src/binance_spot_ws.rs

@@ -0,0 +1,5 @@
+ 
+
+pub struct BinanceSpotWs {}
+
+impl BinanceSpotWs {}

+ 5 - 0
exchanges/src/binance_usdt_swap_rest.rs

@@ -0,0 +1,5 @@
+
+
+pub struct BinanceUsdtSwapRest {}
+
+impl BinanceUsdtSwapRest {}

+ 1 - 0
exchanges/src/binance_usdt_swap_ws.rs

@@ -252,6 +252,7 @@ impl BinanceUsdtSwapWs {
                         let parse_fn_lock = parse_fn_clone.lock().await;
                         parse_fn_lock(req_data).await;
                     });
+                    tokio::spawn(async move {});
                 }
                 Ok(Message::Ping(s)) => {
                     println!("Ping-响应--{:?}", String::from_utf8(s));

+ 4 - 1
exchanges/src/lib.rs

@@ -1,3 +1,6 @@
-pub mod binance_usdt_swap_ws;
 pub mod proxy;
 pub mod response_base;
+pub mod binance_usdt_swap_ws;
+mod binance_usdt_swap_rest;
+mod binance_spot_rest;
+mod binance_spot_ws;

+ 25 - 0
exchanges/tests/test.rs

@@ -0,0 +1,25 @@
+use std::collections::BTreeMap;
+use std::io;
+use exchanges::binance_usdt_swap_ws;
+use exchanges::binance_usdt_swap_ws::BinanceUsdtSwapWs;
+use exchanges::response_base::ResponseData;
+use std::io::{Read, Write};
+
+#[tokio::test]
+ async fn test_import() {
+    //币安---深度socket-公共频道订阅
+    let get_res_data = move |res_data: ResponseData| {
+        async move {
+            // println!("?????{:?}", res_data);
+            let mut stdout = io::stdout();
+            writeln!(stdout, "?????-响应--{:?}", res_data).unwrap();
+        }
+    };
+
+
+    let mut btree_map: BTreeMap<String, String> = BTreeMap::new();
+    // btree_map.insert("lable".parse().unwrap(), "binance".parse().unwrap());//交易行名称
+
+    let ba_exc = BinanceUsdtSwapWs::new(false, true, btree_map);
+    ba_exc.kline(vec![&"BTCUSDT"], get_res_data);
+}