Administrator
2024-04-19 d9312035f4be6ab52061351eebeaf30b6065b3df
成交数据加入耗时日志
1个文件已修改
15 ■■■■ 已修改文件
l2/l2_transaction_data_processor.py 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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}")