Browse Source

查看格式化深度需要多少时间,实在不行咱们换

skyffire 1 year ago
parent
commit
10af5ba007
3 changed files with 4 additions and 4 deletions
  1. 2 0
      standard/src/handle_info.rs
  2. 2 2
      strategy/src/core.rs
  3. 0 2
      strategy/src/gate_swap.rs

+ 2 - 0
standard/src/handle_info.rs

@@ -6,6 +6,7 @@ use rust_decimal_macros::dec;
 use tracing::{error};
 use tracing::{error};
 use exchanges::response_base::ResponseData;
 use exchanges::response_base::ResponseData;
 use global::public_params;
 use global::public_params;
+use global::trace_stack::TraceStack;
 use crate::exchange::ExchangeEnum;
 use crate::exchange::ExchangeEnum;
 use crate::{Account, binance_swap_handle, gate_swap_handle, MarketOrder, Position, SpecialDepth, SpecialOrder, SpecialTicker};
 use crate::{Account, binance_swap_handle, gate_swap_handle, MarketOrder, Position, SpecialDepth, SpecialOrder, SpecialTicker};
 
 
@@ -236,6 +237,7 @@ pub fn format_depth(exchange: ExchangeEnum, res_data: &ResponseData) -> DepthPar
         ExchangeEnum::GateSwap => {
         ExchangeEnum::GateSwap => {
             depth_asks = gate_swap_handle::format_depth_items(&res_data.data["asks"]);
             depth_asks = gate_swap_handle::format_depth_items(&res_data.data["asks"]);
             depth_bids = gate_swap_handle::format_depth_items(&res_data.data["bids"]);
             depth_bids = gate_swap_handle::format_depth_items(&res_data.data["bids"]);
+            TraceStack::show_delay(&res_data.ins);
             // todo! 有id可以取 保证与py一致
             // todo! 有id可以取 保证与py一致
             t = Decimal::from_str(&res_data.data["t"].to_string()).unwrap();
             t = Decimal::from_str(&res_data.data["t"].to_string()).unwrap();
             create_at = res_data.data["t"].as_i64().unwrap() * 1000;
             create_at = res_data.data["t"].as_i64().unwrap() * 1000;

+ 2 - 2
strategy/src/core.rs

@@ -306,7 +306,7 @@ impl Core {
     }
     }
 
 
     #[instrument(skip(self, data, trace_stack), level="TRACE")]
     #[instrument(skip(self, data, trace_stack), level="TRACE")]
-    pub async fn update_local_order(&mut self, data: OrderInfo, mut trace_stack: TraceStack) {
+    pub async fn update_local_order(&mut self, data: OrderInfo, trace_stack: TraceStack) {
         // if data.filled != Decimal::ZERO {
         // if data.filled != Decimal::ZERO {
         //     info!("\n\n");
         //     info!("\n\n");
         //     info!("接收到订单信息①:{:?}", data);
         //     info!("接收到订单信息①:{:?}", data);
@@ -608,7 +608,7 @@ impl Core {
     }
     }
 
 
     #[instrument(skip(self, depth, name, trace_stack), level="TRACE")]
     #[instrument(skip(self, depth, name, trace_stack), level="TRACE")]
-    pub async fn _update_depth(&mut self, depth: Vec<Decimal>, name: String, mut trace_stack: TraceStack) {
+    pub async fn _update_depth(&mut self, depth: Vec<Decimal>, name: String, trace_stack: TraceStack) {
         // 要从回调传入的深度信息中获取data.name
         // 要从回调传入的深度信息中获取data.name
         let market_update_interval_key = name.clone();
         let market_update_interval_key = name.clone();
         let market_update_time_key = name.clone();
         let market_update_time_key = name.clone();

+ 0 - 2
strategy/src/gate_swap.rs

@@ -106,8 +106,6 @@ async fn on_data(core_arc_clone: Arc<Mutex<Core>>,
         trace_stack.set_source("gate_swap.order_book".to_string());
         trace_stack.set_source("gate_swap.order_book".to_string());
         let depth = standard::handle_info::HandleSwapInfo::handle_special_depth(GateSwap, &data);
         let depth = standard::handle_info::HandleSwapInfo::handle_special_depth(GateSwap, &data);
 
 
-        TraceStack::show_delay(&data.ins);
-
         on_special_depth(core_arc_clone, update_flag_u, data.label.clone(), trace_stack, depth).await;
         on_special_depth(core_arc_clone, update_flag_u, data.label.clone(), trace_stack, depth).await;
     } else if data.channel == "futures.balances" {
     } else if data.channel == "futures.balances" {
         let account = standard::handle_info::HandleSwapInfo::handle_account_info(GateSwap, data, run_symbol.clone());
         let account = standard::handle_info::HandleSwapInfo::handle_account_info(GateSwap, data, run_symbol.clone());