Browse Source

修复锁的问题。此版本可以正常使用的。

skyfffire 2 years ago
parent
commit
eaf757538f
3 changed files with 82 additions and 99 deletions
  1. 4 17
      src/quant_libs.rs
  2. 59 62
      strategy/src/exchange_disguise.rs
  3. 19 20
      strategy/src/quant.rs

+ 4 - 17
src/quant_libs.rs

@@ -8,7 +8,6 @@ use std::sync::atomic::{AtomicBool};
 use std::time::Duration;
 use tokio::sync::{mpsc, Mutex};
 use tracing::{error, info};
-use global::delay_time::DelayTime;
 use global::params::Params;
 use standard::Order;
 use strategy::model::OrderInfo;
@@ -24,29 +23,17 @@ pub async fn init(params: Params, ws_running: Arc<AtomicBool>, running: Arc<Atom
     let (error_sender, mut error_receiver) = mpsc::channel::<Error>(100);
 
     let mut quant_obj = Quant::new(params.exchange.clone(), params.clone(), exchange_params.clone(), order_sender.clone(), error_sender.clone(), running.clone()).await;
-    let delay_time = DelayTime{
-        network: 0,
-        format_start: 0,
-        format_end: 0,
-        quant_start: 0,
-        quant_end: 0,
-        strategy_start: 0,
-        strategy_end: 0,
-        source: "".to_string(),
-        order_command: "".to_string(),
-    };
     let ref_name = quant_obj.ref_name[0].clone();
     let trade_name = quant_obj.trade_name.clone();
 
     info!("quant初始化……");
     quant_obj.before_trade().await;
     let quant_arc = Arc::new(Mutex::new(quant_obj));
-    let delay_time_lock: Arc<Mutex<DelayTime>> = Arc::new(Mutex::new(delay_time));
 
     // 参考交易所
-    exchange_disguise::run_reference_exchange(ws_running.clone(),params.ref_exchange.get(0).unwrap().clone(), quant_arc.clone(), ref_name, params.ref_pair.clone(), exchange_params.clone(), delay_time_lock.clone()).await;
+    exchange_disguise::run_reference_exchange(ws_running.clone(),params.ref_exchange.get(0).unwrap().clone(), quant_arc.clone(), ref_name, params.ref_pair.clone(), exchange_params.clone()).await;
     // 交易交易所
-    exchange_disguise::run_transactional_exchange(ws_running.clone(), params.exchange, quant_arc.clone(),  trade_name, vec![params.pair.clone()], exchange_params.clone(), delay_time_lock.clone()).await;
+    exchange_disguise::run_transactional_exchange(ws_running.clone(), params.exchange, quant_arc.clone(),  trade_name, vec![params.pair.clone()], exchange_params.clone()).await;
     // 启动定期触发的系统逻辑
     quant::on_timer(quant_arc.clone());
     // 启动策略逻辑
@@ -62,7 +49,7 @@ pub async fn init(params: Params, ws_running: Arc<AtomicBool>, running: Arc<Atom
                 Some(order) => {
                     if order.status != "NULL" {
                         let mut quant = order_handler_quant_arc.lock().await;
-                        let mut delay_time_lock_instance = delay_time_lock.lock().await;
+                        // let mut delay_time_lock_instance = delay_time_lock.lock().await;
                         let order_info = OrderInfo {
                             symbol: "".to_string(),
                             amount: order.amount.abs(),
@@ -78,7 +65,7 @@ pub async fn init(params: Params, ws_running: Arc<AtomicBool>, running: Arc<Atom
                             fee: Default::default(),
                         };
 
-                        quant.update_local_order(order_info.clone(), &mut delay_time_lock_instance);
+                        quant.update_local_order(order_info.clone());
                     }
                 },
                 None => {

+ 59 - 62
strategy/src/exchange_disguise.rs

@@ -3,7 +3,6 @@ use std::str::FromStr;
 use std::sync::Arc;
 use std::sync::atomic::AtomicBool;
 use std::time::Duration;
-use chrono::{Utc};
 use rust_decimal::Decimal;
 use serde_json::Value;
 use tokio::spawn;
@@ -16,20 +15,19 @@ use exchanges::binance_swap_ws::{BinanceSubscribeType, BinanceSwapWs, BinanceWsT
 use exchanges::gate_swap_rest::GateSwapRest;
 use exchanges::gate_swap_ws::{GateSubscribeType, GateSwapWs, GateWsType};
 use exchanges::kucoin_swap_ws::{KucoinSubscribeType, KucoinSwapWs, KucoinWsType};
-use global::delay_time::DelayTime;
 use standard::exchange::ExchangeEnum::{BinanceSpot, BinanceSwap, GateSwap, KucoinSwap};
 use standard::SpecialTicker;
 use crate::model::{OrderInfo, OriginalTicker, OriginalTradeBa, OriginalTradeGa};
 use crate::quant::Quant;
 
 // 交易交易所启动
-pub async fn run_transactional_exchange(bool_v1 :Arc<AtomicBool>, exchange_name: String, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>, time_record: Arc<Mutex<DelayTime>>){
+pub async fn run_transactional_exchange(bool_v1 :Arc<AtomicBool>, exchange_name: String, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>){
     match exchange_name.as_str() {
         "gate_usdt_swap" => {
-            gate_swap_run(bool_v1, time_record, 1i8, quant_arc, name, symbols, exchange_params).await;
+            gate_swap_run(bool_v1, 1i8, quant_arc, name, symbols, exchange_params).await;
         }
         "kucoin_usdt_swap" => {
-            kucoin_swap_run(bool_v1, time_record, 1i8, quant_arc, name, symbols, exchange_params).await;
+            kucoin_swap_run(bool_v1, 1i8, quant_arc, name, symbols, exchange_params).await;
         }
         _ => {
             error!("交易交易所启动失败,参数错误!")
@@ -38,19 +36,19 @@ pub async fn run_transactional_exchange(bool_v1 :Arc<AtomicBool>, exchange_name:
 }
 
 // 参考交易所启动
-pub async fn run_reference_exchange(bool_v1 :Arc<AtomicBool>, exchange_name: String, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>, time_record: Arc<Mutex<DelayTime>>){
+pub async fn run_reference_exchange(bool_v1 :Arc<AtomicBool>, exchange_name: String, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>){
     match exchange_name.as_str() {
         "binance_usdt_swap" => {
-            reference_binance_swap_run(bool_v1,time_record, quant_arc, name, symbols, exchange_params).await;
+            reference_binance_swap_run(bool_v1, quant_arc, name, symbols, exchange_params).await;
         }
         "binance_usdt_spot" => {
-            reference_binance_spot_run(bool_v1,time_record, quant_arc, name, symbols, exchange_params).await;
+            reference_binance_spot_run(bool_v1, quant_arc, name, symbols, exchange_params).await;
         }
         "gate_usdt_swap" => {
-            gate_swap_run(bool_v1, time_record,0i8, quant_arc, name, symbols, exchange_params).await;
+            gate_swap_run(bool_v1,0i8, quant_arc, name, symbols, exchange_params).await;
         }
         "kucoin_usdt_swap" => {
-            kucoin_swap_run(bool_v1, time_record,0i8, quant_arc, name, symbols, exchange_params).await;
+            kucoin_swap_run(bool_v1,0i8, quant_arc, name, symbols, exchange_params).await;
         }
         _ => {
             error!("参考交易所启动失败,参数错误!")
@@ -59,7 +57,7 @@ pub async fn run_reference_exchange(bool_v1 :Arc<AtomicBool>, exchange_name: Str
 }
 
 // 1交易、0参考 gate 合约 启动
-async fn gate_swap_run(bool_v1 :Arc<AtomicBool>, time_record: Arc<Mutex<DelayTime>>, type_num: i8, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>){
+async fn gate_swap_run(bool_v1 :Arc<AtomicBool>, type_num: i8, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>){
     let (tx, mut rx) = channel(100);
     let mut gate_exc = GateSwapRest::new(false, exchange_params.clone());
     // 获取user_id
@@ -118,16 +116,16 @@ async fn gate_swap_run(bool_v1 :Arc<AtomicBool>, time_record: Arc<Mutex<DelayTim
                         continue;
                     }
                     if data.channel == "futures.order_book" {
-                        let mut time_delay = time_record.lock().await;
-                        time_delay.network = data.time.clone();
-                        time_delay.format_start = Utc::now().timestamp_micros();
+                        // let mut time_delay = time_record.lock().await;
+                        // time_delay.network = data.time.clone();
+                        // time_delay.format_start = Utc::now().timestamp_micros();
                         let depth = standard::handle_info::HandleSwapInfo::handle_special_depth(GateSwap, data);
-                        time_delay.format_end = Utc::now().timestamp_micros();
+                        // time_delay.format_end = Utc::now().timestamp_micros();
                         {
                             let mut quant = bot_arc_clone.lock().await;
-                            time_delay.quant_start = Utc::now().timestamp_micros();
+                            // time_delay.quant_start = Utc::now().timestamp_micros();
                             quant._update_ticker(depth.ticker.clone(), depth.name.clone());
-                            quant._update_depth(depth.depth.clone(), depth.name.clone(), &mut time_delay);
+                            quant._update_depth(depth.depth.clone(), depth.name.clone());
                             quant.local_depths.insert(depth.name, depth.depth);
                         }
                     } else if data.channel == "futures.balances" {
@@ -137,9 +135,9 @@ async fn gate_swap_run(bool_v1 :Arc<AtomicBool>, time_record: Arc<Mutex<DelayTim
                             quant.update_equity(account);
                         }
                     } else if data.channel == "futures.orders" {
-                        let mut time_delay = time_record.lock().await;
-                        time_delay.network = data.time.clone();
-                        time_delay.format_start = Utc::now().timestamp_micros();
+                        // let mut time_delay = time_record.lock().await;
+                        // time_delay.network = data.time.clone();
+                        // time_delay.format_start = Utc::now().timestamp_micros();
                         let orders = standard::handle_info::HandleSwapInfo::handle_order(GateSwap, data.clone(), multiplier.clone());
                         let mut order_infos:Vec<OrderInfo> = Vec::new();
                         for order in orders.order {
@@ -159,11 +157,11 @@ async fn gate_swap_run(bool_v1 :Arc<AtomicBool>, time_record: Arc<Mutex<DelayTim
                             };
                             order_infos.push(order_info);
                         }
-                        time_delay.format_end = Utc::now().timestamp_micros();
+                        // time_delay.format_end = Utc::now().timestamp_micros();
                         {
                             let mut quant = bot_arc_clone.lock().await;
-                            time_delay.quant_start = Utc::now().timestamp_micros();
-                            quant.update_order(order_infos, &mut time_delay);
+                            // time_delay.quant_start = Utc::now().timestamp_micros();
+                            quant.update_order(order_infos);
                         }
                     } else if data.channel == "futures.positions" {
                         let positions = standard::handle_info::HandleSwapInfo::handle_position(GateSwap,data, multiplier.clone());
@@ -201,7 +199,7 @@ async fn gate_swap_run(bool_v1 :Arc<AtomicBool>, time_record: Arc<Mutex<DelayTim
 }
 
 // 1交易、0参考 kucoin 合约 启动
-async fn kucoin_swap_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<Mutex<DelayTime>>, type_num: i8, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>){
+async fn kucoin_swap_run(bool_v1 :Arc<AtomicBool>, type_num: i8, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>){
     let (tx, mut rx) = channel(100);
     let symbols_clone = symbols.clone();
     let mut symbol_arr = Vec::new();
@@ -247,16 +245,16 @@ async fn kucoin_swap_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<Mutex<Delay
                         continue;
                     }
                     if data.channel == "level2" {
-                        let mut time_delay = time_record.lock().await;
-                        time_delay.network = data.time.clone();
-                        time_delay.format_start = Utc::now().timestamp_micros();
+                        // let mut time_delay = time_record.lock().await;
+                        // time_delay.network = data.time.clone();
+                        // time_delay.format_start = Utc::now().timestamp_micros();
                         let depth = standard::handle_info::HandleSwapInfo::handle_special_depth(KucoinSwap,data);
-                        time_delay.format_end = Utc::now().timestamp_micros();
+                        // time_delay.format_end = Utc::now().timestamp_micros();
                         {
                             let mut quant = bot_arc_clone.lock().await;
-                            time_delay.quant_start = Utc::now().timestamp_micros();
+                            // time_delay.quant_start = Utc::now().timestamp_micros();
                             quant._update_ticker(depth.ticker.clone(), depth.name.clone());
-                            quant._update_depth(depth.depth.clone(), depth.name.clone(), &mut time_delay);
+                            quant._update_depth(depth.depth.clone(), depth.name.clone());
                             quant.local_depths.insert(depth.name, depth.depth);
                         }
                     } else if data.channel == "tickerV2" {
@@ -273,9 +271,9 @@ async fn kucoin_swap_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<Mutex<Delay
                             quant.update_equity(account);
                         }
                     } else if data.channel == "symbolOrderChange" {
-                        let mut time_delay = time_record.lock().await;
-                        time_delay.network = data.time.clone();
-                        time_delay.format_start = Utc::now().timestamp_micros();
+                        // let mut time_delay = time_record.lock().await;
+                        // time_delay.network = data.time.clone();
+                        // time_delay.format_start = Utc::now().timestamp_micros();
                         let orders = standard::handle_info::HandleSwapInfo::handle_order(KucoinSwap, data.clone(), multiplier);
                         let mut order_infos:Vec<OrderInfo> = Vec::new();
                         for order in orders.order {
@@ -298,11 +296,11 @@ async fn kucoin_swap_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<Mutex<Delay
                             };
                             order_infos.push(order_info);
                         }
-                        time_delay.format_end = Utc::now().timestamp_micros();
+                        // time_delay.format_end = Utc::now().timestamp_micros();
                         {
                             let mut quant = bot_arc_clone.lock().await;
-                            time_delay.quant_start = Utc::now().timestamp_micros();
-                            quant.update_order(order_infos, &mut time_delay);
+                            // time_delay.quant_start = Utc::now().timestamp_micros();
+                            quant.update_order(order_infos);
                         }
                     } else if data.channel == "position.change" {
                         let positions = standard::handle_info::HandleSwapInfo::handle_position(KucoinSwap,data, multiplier);
@@ -340,7 +338,7 @@ async fn kucoin_swap_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<Mutex<Delay
 }
 
 // 参考 币安 现货 启动
-async fn reference_binance_spot_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<Mutex<DelayTime>>, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>){
+async fn reference_binance_spot_run(bool_v1 :Arc<AtomicBool>, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>){
     let (tx, mut rx) = channel(100);
     spawn(async move {
         let mut ba_exc = BinanceSpotWs::new_label(name, false, exchange_params, BinanceSpotWsType::PublicAndPrivate, tx);
@@ -384,22 +382,22 @@ async fn reference_binance_spot_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<
                             quant.max_buy_min_sell_cache.insert(data.label, vec![max_buy, min_sell]);
                         }
                     } else if data.channel == "bookTicker" {
-                        let mut time_delay = time_record.lock().await;
-                        time_delay.network = data.time.clone();
-                        time_delay.format_start = Utc::now().timestamp_micros();
+                        // let mut time_delay = time_record.lock().await;
+                        // time_delay.network = data.time.clone();
+                        // time_delay.format_start = Utc::now().timestamp_micros();
                         let ticker: OriginalTicker = serde_json::from_str(data.data.as_str()).unwrap();
-                        time_delay.format_end = Utc::now().timestamp_micros();
+                        // time_delay.format_end = Utc::now().timestamp_micros();
                         if ticker.u > update_flag_u {
                             {
                                 let mut quant = bot_arc_clone.lock().await;
-                                time_delay.quant_start = Utc::now().timestamp_micros();
+                                // time_delay.quant_start = Utc::now().timestamp_micros();
                                 quant._update_ticker(SpecialTicker{
                                     sell: ticker.a.clone(),
                                     buy: ticker.b.clone(),
                                     mid_price: Default::default(),
                                 }, data.label.clone());
                                 let depth = vec![ticker.b, ticker.B, ticker.a, ticker.A];
-                                quant._update_depth(depth.clone(), data.label.clone(), &mut time_delay);
+                                quant._update_depth(depth.clone(), data.label.clone());
                                 quant.local_depths.insert(data.label.clone(), depth);
                             }
                         } else {
@@ -410,16 +408,16 @@ async fn reference_binance_spot_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<
                         let v: Value = serde_json::from_str(data.data.clone().as_str()).unwrap();
                         let u = v["lastUpdateId"].as_i64().unwrap();
                         if u > update_flag_u {
-                            let mut time_delay = time_record.lock().await;
-                            time_delay.network = data.time.clone();
-                            time_delay.format_start = Utc::now().timestamp_micros();
+                            // let mut time_delay = time_record.lock().await;
+                            // time_delay.network = data.time.clone();
+                            // time_delay.format_start = Utc::now().timestamp_micros();
                             let depth = standard::handle_info::HandleSwapInfo::handle_special_depth(BinanceSpot, data);
-                            time_delay.format_end = Utc::now().timestamp_micros();
+                            // time_delay.format_end = Utc::now().timestamp_micros();
                             {
                                 let mut quant = bot_arc_clone.lock().await;
-                                time_delay.quant_start = Utc::now().timestamp_micros();
+                                // time_delay.quant_start = Utc::now().timestamp_micros();
                                 quant._update_ticker(depth.ticker.clone(), depth.name.clone());
-                                quant._update_depth(depth.depth.clone(), depth.name.clone(), &mut time_delay);
+                                quant._update_depth(depth.depth.clone(), depth.name.clone());
                                 quant.local_depths.insert(depth.name, depth.depth);
                             }
 
@@ -441,7 +439,7 @@ async fn reference_binance_spot_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<
 
 
 // 参考 币安 合约 启动
-async fn reference_binance_swap_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<Mutex<DelayTime>>, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>){
+async fn reference_binance_swap_run(bool_v1 :Arc<AtomicBool>, quant_arc: Arc<Mutex<Quant>>, name: String, symbols: Vec<String>, exchange_params: BTreeMap<String, String>){
     let (tx, mut rx) = channel(100);
     spawn( async move {
         let mut ba_exc = BinanceSwapWs::new_label(name, false, exchange_params, BinanceWsType::PublicAndPrivate, tx);
@@ -484,22 +482,22 @@ async fn reference_binance_swap_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<
                             quant.max_buy_min_sell_cache.insert(data.label, vec![max_buy, min_sell]);
                         }
                     } else if data.channel == "bookTicker" {
-                        let mut time_delay = time_record.lock().await;
-                        time_delay.network = data.time.clone();
-                        time_delay.format_start = Utc::now().timestamp_micros();
+                        // let mut time_delay = time_record.lock().await;
+                        // time_delay.network = data.time.clone();
+                        // time_delay.format_start = Utc::now().timestamp_micros();
                         let ticker: OriginalTicker = serde_json::from_str(data.data.as_str()).unwrap();
-                        time_delay.format_end = Utc::now().timestamp_micros();
+                        // time_delay.format_end = Utc::now().timestamp_micros();
                         if ticker.u > update_flag_u {
                             {
                                 let mut quant = bot_arc_clone.lock().await;
-                                time_delay.quant_start = Utc::now().timestamp_micros();
+                                // time_delay.quant_start = Utc::now().timestamp_micros();
                                 quant._update_ticker(SpecialTicker{
                                     sell: ticker.a.clone(),
                                     buy: ticker.b.clone(),
                                     mid_price: Default::default(),
                                 }, data.label.clone());
                                 let depth = vec![ticker.b, ticker.B, ticker.a, ticker.A];
-                                quant._update_depth(depth.clone(), data.label.clone(), &mut time_delay);
+                                quant._update_depth(depth.clone(), data.label.clone());
                                 quant.local_depths.insert(data.label.clone(), depth);
                             }
                         } else {
@@ -510,16 +508,15 @@ async fn reference_binance_swap_run(bool_v1 :Arc<AtomicBool>, time_record : Arc<
                         let v: Value = serde_json::from_str(data.data.clone().as_str()).unwrap();
                         let u = v["u"].as_i64().unwrap();
                         if u > update_flag_u {
-                            let mut time_delay = time_record.lock().await;
-                            time_delay.network = data.time.clone();
-                            time_delay.format_start = Utc::now().timestamp_micros();
+                            // time_delay.network = data.time.clone();
+                            // time_delay.format_start = Utc::now().timestamp_micros();
                             let depth = standard::handle_info::HandleSwapInfo::handle_special_depth(BinanceSwap, data);
-                            time_delay.format_end = Utc::now().timestamp_micros();
+                            // time_delay.format_end = Utc::now().timestamp_micros();
                             {
                                 let mut quant = bot_arc_clone.lock().await;
-                                time_delay.quant_start = Utc::now().timestamp_micros();
+                                // time_delay.quant_start = Utc::now().timestamp_micros();
                                 quant._update_ticker(depth.ticker.clone(), depth.name.clone());
-                                quant._update_depth(depth.depth.clone(), depth.name.clone(), &mut time_delay);
+                                quant._update_depth(depth.depth.clone(), depth.name.clone());
                                 quant.local_depths.insert(depth.name, depth.depth);
                             }
                         } else {

+ 19 - 20
strategy/src/quant.rs

@@ -11,11 +11,10 @@ use rust_decimal::prelude::{ToPrimitive};
 use rust_decimal_macros::dec;
 use tokio::spawn;
 use tokio::sync::mpsc::{Receiver, Sender};
-use tokio::sync::{Mutex, MutexGuard};
+use tokio::sync::{Mutex};
 use tokio::task::JoinHandle;
 use tokio::time::sleep;
 use tracing::{debug, error, info, warn};
-use global::delay_time::DelayTime;
 use global::params::Params;
 use global::public_params::{ASK_PRICE_INDEX, BID_PRICE_INDEX, LENGTH};
 use standard::{Account, Market, Order, OrderCommand, Platform, Position, PositionModeEnum, SpecialTicker, Ticker};
@@ -265,7 +264,7 @@ impl Quant {
         return quant_obj;
     }
 
-    pub async fn handle_signals(quant_arc: Arc<Mutex<Quant>>, mut rx: Receiver<Order>, time_record: Arc<Mutex<DelayTime>>) {
+    pub async fn handle_signals(quant_arc: Arc<Mutex<Quant>>, mut rx: Receiver<Order>) {
         spawn(async move{
             loop {
                 sleep(Duration::from_millis(1)).await;
@@ -294,9 +293,9 @@ impl Quant {
                                 local_order_info.client_id = val.custom_id;
                             }
                             let mut bot = quant_arc.lock().await;
-                            let mut time_delay = time_record.lock().await;
+                            // let mut time_delay = time_record.lock().await;
                             // 写入本地订单缓存
-                            bot.update_local_order(local_order_info, &mut time_delay);
+                            bot.update_local_order(local_order_info);
                         }
                     },
                     Err(e) => {
@@ -307,13 +306,13 @@ impl Quant {
             }
         });
     }
-    pub fn update_order(&mut self, data: Vec<OrderInfo>, time_record: &mut MutexGuard<DelayTime>){
+    pub fn update_order(&mut self, data: Vec<OrderInfo>){
         for order in data {
-            self.update_local_order(order, time_record);
+            self.update_local_order(order);
         }
     }
 
-    pub fn update_local_order(&mut self, data: OrderInfo, time_record: &mut MutexGuard<DelayTime>) {
+    pub fn update_local_order(&mut self, data: OrderInfo) {
         if data.filled != Decimal::ZERO {
             info!("\n\n");
             info!("接收到订单信息①:{:?}", data);
@@ -487,7 +486,7 @@ impl Quant {
                                 self.local_profit -= data.fee;
                             }
                         }
-                        info!("成交单耗时数据:{}", time_record.to_string());
+                        // info!("成交单耗时数据:{}", time_record.to_string());
                         info!("更新推算仓位 {:?}", self.local_position_by_orders);
                         // 本地计算利润
                         self._print_local_trades_summary();
@@ -502,16 +501,16 @@ impl Quant {
                         // 触发策略挂单逻辑
                         // 更新策略时间
                         self.strategy.local_time = Utc::now().timestamp_millis();
-                        time_record.strategy_start = Utc::now().timestamp_micros();
+                        // time_record.strategy_start = Utc::now().timestamp_micros();
                         let order = self.strategy.on_time(&self.trade_msg);
-                        time_record.strategy_end = Utc::now().timestamp_micros();
+                        // time_record.strategy_end = Utc::now().timestamp_micros();
                         // 记录指令触发信息
                         if order.is_not_empty() {
                             // info!("触发onOrder");
                             self._update_local_orders(&order);
-                            time_record.quant_end = Utc::now().timestamp_micros();
-                            time_record.source = "508 orderUpdate".to_string();
-                            time_record.order_command = order.to_string();
+                            // time_record.quant_end = Utc::now().timestamp_micros();
+                            // time_record.source = "508 orderUpdate".to_string();
+                            // time_record.order_command = order.to_string();
                             //交易所处理订单信号
                             let mut platform_rest_fb = self.platform_rest.clone_box();
                             // info!("订单指令:{:?}", order);
@@ -582,7 +581,7 @@ impl Quant {
         self.ready = 1
     }
 
-    pub fn _update_depth(&mut self, depth: Vec<Decimal>, name :String, time_record: &mut MutexGuard<DelayTime>) {
+    pub fn _update_depth(&mut self, depth: Vec<Decimal>, name :String) {
         // 要从回调传入的深度信息中获取data.name
         let market_update_interval_key = name.clone();
         let market_update_time_key = name.clone();
@@ -637,18 +636,18 @@ impl Quant {
                 // 更新策略时间
                 self.strategy.local_time = Utc::now().timestamp_millis();
 
-                time_record.strategy_start = Utc::now().timestamp_micros();
+                // time_record.strategy_start = Utc::now().timestamp_micros();
                 // 产生交易信号
                 let orders = self.strategy.on_time(&self.trade_msg);
-                time_record.strategy_end = Utc::now().timestamp_micros();
+                // time_record.strategy_end = Utc::now().timestamp_micros();
                 if orders.is_not_empty() {
                     debug!("触发onTick");
                     self._update_local_orders(&orders);
-                    time_record.quant_end = Utc::now().timestamp_micros();
+                    // time_record.quant_end = Utc::now().timestamp_micros();
                     //异步交易所处理订单信号
                     let mut platform_rest_fb = self.platform_rest.clone_box();
-                    time_record.source = "646 depth".to_string();
-                    time_record.order_command = orders.to_string();
+                    // time_record.source = "646 depth".to_string();
+                    // time_record.order_command = orders.to_string();
                     // info!("订单指令:{:?}", orders);
                     spawn(async move{
                         // info!("_update_depth订单指令:{:?}", orders);