Explorar el Código

gate新增 高速地址

hl hace 1 año
padre
commit
a95e6780b2
Se han modificado 2 ficheros con 21 adiciones y 17 borrados
  1. 8 8
      exchanges/src/gate_swap_rest.rs
  2. 13 9
      exchanges/src/gate_swap_ws.rs

+ 8 - 8
exchanges/src/gate_swap_rest.rs

@@ -37,17 +37,17 @@ impl GateSwapRest {
     pub fn new_label(label: String, is_colo: bool, login_param: BTreeMap<String, String>) -> GateSwapRest
     {
         let base_url = if is_colo {
-            // "https://apiv4-private.gateapi.io".to_string()
-            "https://api.gateio.ws".to_string()
+            let url = "https://apiv4-private.gateapi.io".to_string();
+            info!("开启高速(未配置,走普通:{})通道",url);
+            url
         } else {
-            "https://api.gateio.ws".to_string()
+            let url = "https://api.gateio.ws".to_string();
+            info!("走普通通道:{}",url);
+            url
         };
 
-        if is_colo {
-            info!("开启高速(未配置,走普通:{})通道",base_url);
-        } else {
-            info!("走普通通道:{}",base_url);
-        }
+
+        if is_colo {} else {}
         /*****返回结构体*******/
         GateSwapRest {
             label,

+ 13 - 9
exchanges/src/gate_swap_ws.rs

@@ -69,15 +69,19 @@ impl GateSwapWs {
         /*******公共频道-私有频道数据组装*/
         let address_url = match ws_type {
             GateSwapWsType::PublicAndPrivate(name) => {
-                format!("wss://fx-ws.gateio.ws/v4/ws/{}", name.to_string())
+                if is_colo {
+                    let url = format!("wss://fxws-privategateapi.io/v4/ws/{}", name.to_string())
+                    info!("开启高速(未配置,走普通:{})通道",url);
+                    url
+                } else {
+                    let url = format!("wss://fx-ws.gateio.ws/v4/ws/{}", name.to_string())
+                    info!("走普通通道:{}",address_url);
+                    url
+                }
             }
         };
 
-        if is_colo {
-            info!("开启高速(未配置,走普通:{})通道",address_url);
-        } else {
-            info!("走普通通道:{}",address_url);
-        }
+
         GateSwapWs {
             label,
             address_url,
@@ -129,13 +133,13 @@ impl GateSwapWs {
     //订阅枚举解析
     pub fn enum_to_string(symbol: String, subscribe_type: GateSwapSubscribeType, login_param: Option<GateSwapLogin>) -> Value {
         let time = chrono::Utc::now().timestamp();
-        let mut  access_key = "".to_string();
+        let mut access_key = "".to_string();
         let mut secret_key = "".to_string();
         match login_param {
             None => {}
             Some(param) => {
-                 access_key = param.api_key.clone();
-                 secret_key = param.secret.clone();
+                access_key = param.api_key.clone();
+                secret_key = param.secret.clone();
             }
         }