DESKTOP-NE65RNK\Citrus_limon 1 vuosi sitten
vanhempi
commit
e64afa7f18

+ 2 - 2
exchanges/src/bingx_swap_rest.rs

@@ -132,9 +132,9 @@ impl BingxSwapRest {
 
         //每个接口都有的参数
         let timestamp = Utc::now().timestamp_millis();
-        let recvWindow = 3000;
+        let recv_window = 3000;
         params["timestamp"] = serde_json::json!(timestamp);
-        params["recvWindow"] = serde_json::json!(recvWindow);
+        params["recvWindow"] = serde_json::json!(recv_window);
 
 
         //请求类型不同,可能请求头body 不同

+ 12 - 15
exchanges/src/bingx_swap_ws.rs

@@ -86,7 +86,7 @@ impl BingxSwapWs {
         };
 
         /*******公共频道-私有频道数据组装*/
-        let  ws_param = BingxSwapWsParam {
+        let ws_param = BingxSwapWsParam {
             token: "".to_string(),
             ws_url: "".to_string(),
             ws_ping_interval: 0,
@@ -275,12 +275,10 @@ impl BingxSwapWs {
     {
         // trace!("原始数据:{:?}",text);
         match text.as_str() {
-            "Ping" =>{
-                return ResponseData::new("".to_string(), -300, "success".to_string(), Value::String(String::from("Pong")))
-            }
-            _ =>{
-
+            "Ping" => {
+                return ResponseData::new("".to_string(), -300, "success".to_string(), Value::String(String::from("Pong")));
             }
+            _ => {}
         }
         let mut res_data = ResponseData::new("".to_string(), 200, "success".to_string(), Value::Null);
         let json_value: serde_json::Value = serde_json::from_str(&text).unwrap();
@@ -291,27 +289,26 @@ impl BingxSwapWs {
             if json_value["code"].as_i64() == Option::from(0) {
                 res_data.code = -201;
                 res_data.message = "订阅成功".to_string();
-            }else{
+            } else {
                 res_data.code = 400;
                 res_data.message = "订阅失败".to_string();
             }
-        }else if json_value["code"].as_i64() == Option::from(0){
+        } else if json_value["code"].as_i64() == Option::from(0) {
             res_data.code = 200;
             res_data.data = json_value.clone();
 
             //订阅数据 甄别
-            let dataType  = json_value["dataType"].as_str().unwrap();
-            if dataType.contains("@depth"){
+            let data_type = json_value["dataType"].as_str().unwrap();
+            if data_type.contains("@depth") {
                 res_data.channel = "futures.order_book".to_string();
-            }else if  dataType.contains("@trade"){
+            } else if data_type.contains("@trade") {
                 res_data.channel = "futures.trades".to_string();
-            }else if dataType.contains("@kline_1m") {
+            } else if data_type.contains("@kline_1m") {
                 res_data.channel = "futures.candlesticks".to_string();
-            }else{
+            } else {
                 res_data.channel = "未知推送数据".to_string();
             }
-
-        }else{
+        } else {
             res_data.code = -1;
             res_data.message = "未知解析".to_string();
         }

+ 2 - 2
exchanges/src/mexc_swap_rest.rs

@@ -132,9 +132,9 @@ impl MexcSwapRest {
 
         //每个接口都有的参数
         let timestamp = Utc::now().timestamp_millis();
-        let recvWindow = 3000;
+        let recv_window = 3000;
         params["timestamp"] = serde_json::json!(timestamp);
-        params["recvWindow"] = serde_json::json!(recvWindow);
+        params["recvWindow"] = serde_json::json!(recv_window);
 
 
         //请求类型不同,可能请求头body 不同

+ 1 - 1
exchanges/src/mexc_swap_ws.rs

@@ -187,7 +187,7 @@ impl MexcSwapWs {
     pub async fn ws_connect_async<F, Future>(&mut self,
                                              is_shutdown_arc: Arc<AtomicBool>,
                                              handle_function: F,
-                                             write_tx_am: &Arc<Mutex<UnboundedSender<Message>>>,
+                                             _write_tx_am: &Arc<Mutex<UnboundedSender<Message>>>,
                                              write_to_socket_rx: UnboundedReceiver<Message>) -> Result<(), Error>
         where
             F: Fn(ResponseData) -> Future + Clone + Send + 'static + Sync,

+ 1 - 2
standard/src/mexc_swap.rs

@@ -1,9 +1,8 @@
 use std::collections::{BTreeMap};
 use std::io::{Error, ErrorKind};
-use std::str::FromStr;
 use tokio::sync::mpsc::Sender;
 use async_trait::async_trait;
-use rust_decimal::{Decimal, MathematicalOps};
+use rust_decimal::{Decimal};
 use serde_json::{json, Value};
 use tracing::{error, info};
 use crate::{Platform, ExchangeEnum, Account, Position, Ticker, Market, Order, utils};

+ 0 - 2
standard/src/mexc_swap_handle.rs

@@ -1,5 +1,3 @@
-use std::str::FromStr;
-use chrono::Utc;
 use rust_decimal::Decimal;
 use rust_decimal::prelude::FromPrimitive;
 use serde_json::Value;