Forráskód Böngészése

高速通道注释

875428575@qq.com 2 éve
szülő
commit
e422052e3e

+ 3 - 1
exchanges/src/binance_spot_ws.rs

@@ -64,7 +64,9 @@ impl BinanceSpotWs {
     ) -> BinanceSpotWs
     {
         if is_colo {
-            trace!("不支持高速通道")
+            info!("开启高速(未配置,走普通)通道");
+        }else{
+            info!("走普通通道");
         }
 
         /*******走代理:根据环境变量配置来决定,如果配置了走代理,没有配置不走*******/

+ 4 - 3
exchanges/src/binance_swap_rest.rs

@@ -7,7 +7,7 @@ use rust_decimal::prelude::FromPrimitive;
 use rust_decimal_macros::dec;
 use crate::http_tool::RestTool;
 use crate::response_base::ResponseData;
-use tracing::trace;
+use tracing::{info, trace};
 use ring::hmac;
 use serde_json::json;
 
@@ -35,9 +35,10 @@ impl BinanceSwapRest {
     pub fn new_label(label: String, is_colo: bool, login_param: BTreeMap<String, String>) -> BinanceSwapRest
     {
         let base_url = if is_colo {
-            trace!("不支持colo高速线路");
+            info!("开启高速(未配置,走普通)通道");
             "https://fapi.binance.com".to_string()
         } else {
+            info!("走普通通道");
             "https://fapi.binance.com".to_string()
         };
 
@@ -392,7 +393,7 @@ impl BinanceSwapRest {
     //res_data 解析
     pub fn res_data_analysis(result: Result<ResponseData, reqwest::Error>, params: String) -> ResponseData {
         match result {
-            Ok(res_data) => { 
+            Ok(res_data) => {
                 if res_data.code != "200" {
                     let message = res_data.message;
                     let json_value: serde_json::Value = serde_json::from_str(&message).unwrap();

+ 4 - 1
exchanges/src/binance_swap_ws.rs

@@ -63,9 +63,12 @@ impl BinanceSwapWs {
     ) -> BinanceSwapWs
     {
         if is_colo {
-            trace!("不支持高速通道")
+            info!("开启高速(未配置,走普通)通道");
+        }else{
+            info!("走普通通道");
         }
 
+
         /*******走代理:根据环境变量配置来决定,如果配置了走代理,没有配置不走*******/
         let parsing_detail = proxy::ParsingDetail::parsing_environment_variables();
 

+ 5 - 3
exchanges/src/gate_swap_rest.rs

@@ -11,7 +11,7 @@ use serde_json::Value;
 use crate::http_tool::RestTool;
 use crate::response_base::ResponseData;
 use sha2::Sha512;
-use tracing::{error, trace};
+use tracing::{error, info, trace};
 
 #[derive(Clone)]
 pub struct GateSwapRest {
@@ -37,9 +37,11 @@ impl GateSwapRest {
     pub fn new_label(label: String, is_colo: bool, login_param: BTreeMap<String, String>) -> GateSwapRest
     {
         let base_url = if is_colo {
-            trace!("使用colo高速线路");
-            "https://apiv4-private.gateapi.io".to_string()
+            info!("开启高速(未配置,走普通)通道");
+            // "https://apiv4-private.gateapi.io".to_string()
+            "https://api.gateio.ws".to_string()
         } else {
+            info!("走普通通道");
             "https://api.gateio.ws".to_string()
         };
 

+ 4 - 2
exchanges/src/gate_swap_ws.rs

@@ -71,8 +71,10 @@ impl GateSwapWs {
     ) -> GateSwapWs
     {
         if is_colo {
-            trace!("支持高速通道-未配置")
-        } else {}
+            info!("开启高速(未配置,走普通)通道");
+        }else{
+            info!("走普通通道");
+        }
 
         /*******走代理:根据环境变量配置来决定,如果配置了走代理,没有配置不走*******/
         let parsing_detail = proxy::ParsingDetail::parsing_environment_variables();

+ 4 - 2
exchanges/src/kucoin_swap_rest.rs

@@ -6,7 +6,7 @@ use rust_decimal::Decimal;
 use rust_decimal::prelude::FromPrimitive;
 use rust_decimal_macros::dec;
 use sha2::Sha256;
-use tracing::trace;
+use tracing::{info, trace};
 use crate::http_tool::RestTool;
 use crate::response_base::ResponseData;
 
@@ -36,12 +36,14 @@ impl KucoinSwapRest {
     }
     pub fn new_lable(label: String, is_colo: bool, login_param: BTreeMap<String, String>) -> KucoinSwapRest {
         let base_url = if is_colo {
-            trace!("不支持colo高速线路");
+            info!("开启高速(未配置,走普通)通道");
             "https://api-futures.kucoin.com".to_string()
         } else {
+            info!("走普通通道");
             "https://api-futures.kucoin.com".to_string()
         };
 
+
         /*****返回结构体*******/
         KucoinSwapRest {
             label,

+ 3 - 1
exchanges/src/kucoin_swap_ws.rs

@@ -78,7 +78,9 @@ impl KucoinSwapWs {
     ) -> KucoinSwapWs
     {
         if is_colo {
-            trace!("不支持高速通道")
+            info!("开启高速(未配置,走普通)通道");
+        }else{
+            info!("走普通通道");
         }
 
         /*******走代理:根据环境变量配置来决定,如果配置了走代理,没有配置不走*******/

+ 11 - 9
exchanges/src/okx_swap_rest.rs

@@ -4,7 +4,7 @@ use reqwest::{Client};
 use rust_decimal::Decimal;
 use rust_decimal::prelude::FromPrimitive;
 use rust_decimal_macros::dec;
-use tracing::trace;
+use tracing::{info, trace};
 use crate::http_tool::RestTool;
 use crate::response_base::ResponseData;
 use ring::hmac;
@@ -35,12 +35,14 @@ impl OkxSwapRest {
     }
     pub fn new_lable(label: String, is_colo: bool, login_param: BTreeMap<String, String>) -> OkxSwapRest {
         let base_url = if is_colo {
-            trace!("不支持colo高速线路");
+            info!("开启高速(未配置,走普通)通道");
             "https://www.okx.com".to_string()
         } else {
+            info!("走普通通道");
             "https://www.okx.com".to_string()
         };
 
+
         /*****返回结构体*******/
         OkxSwapRest {
             label,
@@ -77,7 +79,7 @@ impl OkxSwapRest {
     }
     //获取未成交订单列表
     pub async fn get_incomplete_order(&mut self, symbol: String) -> ResponseData {
-        let  params = serde_json::json!({
+        let params = serde_json::json!({
             "instId":symbol
          });
         let data = self.request("GET".to_string(),
@@ -90,7 +92,7 @@ impl OkxSwapRest {
     }
     //获取系统时间
     pub async fn get_server_time(&mut self) -> ResponseData {
-        let  params = serde_json::json!({
+        let params = serde_json::json!({
          });
         let data = self.request("GET".to_string(),
                                 "/api/v5".to_string(),
@@ -117,7 +119,7 @@ impl OkxSwapRest {
     }
     //获取单个产品行情信息
     pub async fn get_ticker(&mut self, symbol: String) -> ResponseData {
-        let  params = serde_json::json!({
+        let params = serde_json::json!({
             "instId":format!("{}-SWAP",symbol)
          });
         let data = self.request("GET".to_string(),
@@ -130,7 +132,7 @@ impl OkxSwapRest {
     }
     //查看账户余额
     pub async fn get_balance(&mut self, ccy: String) -> ResponseData {
-        let  params = serde_json::json!({
+        let params = serde_json::json!({
             "ccy":ccy
          });
         let data = self.request("GET".to_string(),
@@ -143,7 +145,7 @@ impl OkxSwapRest {
     }
     //获取交易产品基础信息
     pub async fn get_instruments(&mut self) -> ResponseData {
-        let  params = serde_json::json!({
+        let params = serde_json::json!({
            "instType":"SWAP"
          });
         let data = self.request("GET".to_string(),
@@ -204,7 +206,7 @@ impl OkxSwapRest {
     }
     //设置杠杆倍数-单币种保证金`账户在`全仓`交易模式下,设置`币币杠杆`的杠杆倍数(币对层面)
     pub async fn set_leverage(&mut self, symbol: String, lever: String) -> ResponseData {
-        let  params = serde_json::json!({
+        let params = serde_json::json!({
              "instId": symbol,
              "lever": lever,
              "mgnMode": "cross"
@@ -219,7 +221,7 @@ impl OkxSwapRest {
     }
     //设置持仓模式
     pub async fn set_position_mode(&mut self) -> ResponseData {
-        let  params = serde_json::json!({
+        let params = serde_json::json!({
              "posMode": "long_short_mode",
          });
         let data = self.request("POST".to_string(),

+ 4 - 2
exchanges/src/okx_swap_ws.rs

@@ -8,7 +8,7 @@ use chrono::Utc;
 use serde_json::{json, Value};
 use ring::hmac;
 use tokio::sync::mpsc::Sender;
-use tracing::{error, trace};
+use tracing::{error, info, trace};
 use crate::{proxy};
 use tungstenite::client::{AutoStream, connect_with_proxy, ProxyAutoStream};
 use tungstenite::{connect, Message, WebSocket};
@@ -77,7 +77,9 @@ impl OkxSwapWs {
     ) -> OkxSwapWs
     {
         if is_colo {
-            trace!("不支持高速通道")
+            info!("开启高速(未配置,走普通)通道");
+        }else{
+            info!("走普通通道");
         }
 
         /*******走代理:根据环境变量配置来决定,如果配置了走代理,没有配置不走*******/