skyfffire 3 hónapja
szülő
commit
24bb565f05
2 módosított fájl, 30 hozzáadás és 28 törlés
  1. 25 27
      global/src/trace_stack.rs
  2. 5 1
      strategy/src/exchange_disguise.rs

+ 25 - 27
global/src/trace_stack.rs

@@ -1,9 +1,7 @@
 use std::fmt;
 use std::fmt::{Formatter};
-use chrono::Utc;
 use rust_decimal::prelude::ToPrimitive;
 use tokio::time::Instant;
-use tracing::info;
 
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub struct TraceStack {
@@ -44,31 +42,31 @@ impl TraceStack {
         }
     }
 
-    pub fn show_delay(ins: &Instant) {
-        #[warn(static_mut_refs)]
-        pub static mut COUNT: u128 = 0u128;
-        pub static mut SUM_DELAY: u128 = 0u128;
-        pub static mut PREV_LOG_TIMESTAMP: i64 = 0;
-
-        unsafe {
-            let delay = ins.elapsed().as_nanos();
-            COUNT += 1;
-            SUM_DELAY += delay;
-
-            // 30s打印一次
-            let now = Utc::now().timestamp_millis();
-            if now - PREV_LOG_TIMESTAMP > 30 * 1000 {
-                PREV_LOG_TIMESTAMP = now;
-                info!("数据{}条, avg={}ns", COUNT, SUM_DELAY / COUNT);
-            }
-
-            // 总延迟满3亿ns清理一次
-            if SUM_DELAY > 300_000_000 {
-                COUNT = 0;
-                SUM_DELAY = 0;
-            }
-        }
-    }
+    // pub fn show_delay(ins: &Instant) {
+    //     #[warn(static_mut_refs)]
+    //     pub static mut COUNT: u128 = 0u128;
+    //     pub static mut SUM_DELAY: u128 = 0u128;
+    //     pub static mut PREV_LOG_TIMESTAMP: i64 = 0;
+    // 
+    //     unsafe {
+    //         let delay = ins.elapsed().as_nanos();
+    //         COUNT += 1;
+    //         SUM_DELAY += delay;
+    // 
+    //         // 30s打印一次
+    //         let now = Utc::now().timestamp_millis();
+    //         if now - PREV_LOG_TIMESTAMP > 30 * 1000 {
+    //             PREV_LOG_TIMESTAMP = now;
+    //             info!("数据{}条, avg={}ns", COUNT, SUM_DELAY / COUNT);
+    //         }
+    // 
+    //         // 总延迟满3亿ns清理一次
+    //         if SUM_DELAY > 300_000_000 {
+    //             COUNT = 0;
+    //             SUM_DELAY = 0;
+    //         }
+    //     }
+    // }
 
     pub fn on_before_network(&mut self, before_network_millis: i64) {
         self.before_network = before_network_millis;

+ 5 - 1
strategy/src/exchange_disguise.rs

@@ -10,6 +10,7 @@ use crate::bitget_usdt_swap::{bitget_swap_run, reference_bitget_swap_run};
 use crate::coinex_usdt_swap::coinex_swap_run;
 use crate::gate_usdt_swap::gate_swap_run;
 use crate::core::Core;
+use crate::mexc_usdt_swap::{mexc_swap_run, reference_mexc_swap_run};
 
 // 交易交易所启动
 pub async fn run_transactional_exchange(is_shutdown_arc :Arc<AtomicBool>,
@@ -27,7 +28,7 @@ pub async fn run_transactional_exchange(is_shutdown_arc :Arc<AtomicBool>,
             gate_swap_run(is_shutdown_arc, true, core_arc, name, symbols, is_colo, exchange_params).await;
         }
         "mexc_usdt_swap" => {
-            
+            mexc_swap_run(is_shutdown_arc, core_arc, name, symbols, is_colo, exchange_params).await;
         }
         // "kucoin_usdt_swap" => {
         //     kucoin_swap_run(is_shutdown_arc, true, core_arc, name, symbols, is_colo, exchange_params).await;
@@ -75,6 +76,9 @@ pub async fn run_reference_exchange(is_shutdown_arc: Arc<AtomicBool>,
         "gate_usdt_swap" => {
             gate_swap_run(is_shutdown_arc, false, core_arc, name, symbols, is_colo, exchange_params).await;
         },
+        "mexc_usdt_swap" => {
+            reference_mexc_swap_run(is_shutdown_arc, core_arc, name, symbols, is_colo).await;
+        },
         // "okex_usdt_swap" => {
         //     okex_swap_run(is_shutdown_arc, false, core_arc, name, symbols, is_colo, exchange_params).await;
         // },