From d9312035f4be6ab52061351eebeaf30b6065b3df Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 19 四月 2024 15:43:15 +0800 Subject: [PATCH] 成交数据加入耗时日志 --- l2/l2_transaction_data_processor.py | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/l2/l2_transaction_data_processor.py b/l2/l2_transaction_data_processor.py index 8888d02..6ad292f 100644 --- a/l2/l2_transaction_data_processor.py +++ b/l2/l2_transaction_data_processor.py @@ -31,10 +31,11 @@ @classmethod def process_huaxin_transaction_datas(cls, code, datas): + __start_time = time.time() # 璁剧疆鎴愪氦浠� current_price_process_manager.set_trade_price(code, datas[-1][1]) total_datas = l2_data_util.local_today_datas.get(code) - __start_time = time.time() + use_time_list = [] try: buyno_map = l2_data_util.local_today_buyno_map.get(code) if buyno_map is None: @@ -51,6 +52,9 @@ limit_up_price = round(float(limit_up_price), 2) # 缁熻鍗栧崟 big_sell_order_info = HuaXinSellOrderStatisticManager.add_transaction_datas(code, datas, limit_up_price) + + _start_time = time.time() + use_time_list.append(("澶勭悊鍗栧崟鎴愪氦鏁版嵁", _start_time - __start_time)) if is_placed_order: need_cancel, cancel_msg = SCancelBigNumComputer().set_big_sell_order_info_for_cancel(code, big_sell_order_info, @@ -64,10 +68,13 @@ L2TradeDataProcessor.cancel_buy(code, cancel_msg) GCancelBigNumComputer().set_big_sell_order_info(code, big_sell_order_info) + use_time_list.append(("澶勭悊鍗栧崟鐩稿叧鎾ゆ暟鎹�", time.time() - _start_time)) + _start_time = time.time() except Exception as e: async_log_util.error(logger_debug, f"鍗栧崟缁熻寮傚父锛歿big_sell_order_info}") logger_debug.exception(e) + _start_time = time.time() # 璁$畻宸茬粡鎴愪氦鐨勫ぇ鍗� big_money_count = 0 for d in datas: @@ -86,6 +93,9 @@ DealOrderNoManager().add_orderno(code, f"{deal_info[0]}") # L鍚庢槸鍚︽湁鎴愪氦锛屽鏋滄湁鎴愪氦灏遍渶瑕侀櫎鍘诲綋鍓嶇瑪鏁帮紝鐒跺悗閲嶆柊鍥婃嫭涓�绗� LCancelBigNumComputer().add_deal_index(code, data["index"], order_begin_pos.buy_single_index) + + use_time_list.append(("缁熻涔板崟鏁版嵁", time.time() - _start_time)) + _start_time = time.time() if big_money_count > 0: LCancelRateManager.compute_big_num_deal_rate(code) @@ -115,6 +125,7 @@ if is_placed_order: # 瑙﹀彂L鎾や笂閲嶆柊璁$畻 LCancelBigNumComputer().re_compute_l_up_watch_indexes(code, order_begin_pos.buy_single_index) + use_time_list.append(("澶勭悊鎴愪氦杩涘害鐩稿叧鎾�", time.time() - _start_time)) except Exception as e: logging.exception(e) @@ -122,4 +133,4 @@ finally: use_time = int((time.time() - __start_time) * 1000) if use_time > 5: - async_log_util.info(hx_logger_l2_upload, f"{code}澶勭悊鎴愪氦鐢ㄦ椂锛歿use_time}") + async_log_util.info(hx_logger_l2_upload, f"{code}澶勭悊鎴愪氦鐢ㄦ椂锛歿use_time} 璇︽儏:{use_time_list}") -- Gitblit v1.8.0