Administrator
2024-07-16 cf551c3d66c1410bfdfd9f808e98cba77dec5cd1
l2/l2_transaction_data_processor.py
@@ -13,6 +13,7 @@
from l2.huaxin import l2_huaxin_util
from l2.l2_data_manager import OrderBeginPosInfo
from l2.l2_data_manager_new import L2TradeDataProcessor
from l2.l2_data_util import L2DataUtil
from l2.l2_transaction_data_manager import HuaXinBuyOrderManager, HuaXinSellOrderStatisticManager, BigOrderDealManager
from log_module import async_log_util
from log_module.log import hx_logger_l2_debug, logger_l2_trade_buy_queue, logger_debug, hx_logger_l2_upload
@@ -34,7 +35,9 @@
            d = datas[i]
            buy_no = f"{d[6]}"
            if buyno_map and buy_no in buyno_map:
                buy_progress_index = buyno_map[buy_no]["index"]
                # 成交进度位必须是涨停买
                if L2DataUtil.is_limit_up_price_buy(buyno_map[buy_no]["val"]):
                    buy_progress_index = buyno_map[buy_no]["index"]
                break
        return buy_progress_index
@@ -46,7 +49,8 @@
        @param datas:
        @return:
        """
        buy_datas, bigger_buy_datas = HuaXinBuyOrderManager.statistic_big_buy_data(code, datas)
        limit_up_price = round(float(gpcode_manager.get_limit_up_price(code)), 2)
        buy_datas, bigger_buy_datas = HuaXinBuyOrderManager.statistic_big_buy_data(code, datas, limit_up_price)
        if buy_datas:
            BigOrderDealManager().add_buy_datas(code, buy_datas)
        try:
@@ -80,7 +84,8 @@
            limit_up_price = round(float(limit_up_price), 2)
        # 设置成交价
        try:
            current_price_process_manager.set_trade_price(code, datas[-1][1], l2_huaxin_util.convert_time( datas[-1][3]), limit_up_price)
            current_price_process_manager.set_trade_price(code, datas[-1][1], l2_huaxin_util.convert_time(datas[-1][3]),
                                                          limit_up_price)
        except:
            pass
        total_datas = l2_data_util.local_today_datas.get(code)
@@ -110,22 +115,24 @@
                    if need_cancel:
                        cancel_msg = f"S撤:{cancel_msg}"
                    if not need_cancel:
                        need_cancel, cancel_msg = FCancelBigNumComputer().need_cancel_for_p(code, big_sell_order_info,
                        need_cancel, cancel_msg = FCancelBigNumComputer().need_cancel_for_p(code,
                                                                                            order_begin_pos)
                    # 判断时间是否与本地时间相差5s以上
                    if tool.trade_time_sub(tool.get_now_time_str(), l2_huaxin_util.convert_time(datas[-1][3])) > 10:
                        need_cancel, cancel_msg = True, f"成交时间与本地时间相差10S以上,{l2_huaxin_util.convert_time(datas[-1][3])}"
                        now_seconds = int(tool.get_now_time_str().replace(":", ""))
                        if now_seconds < int("093200"): #or int("130000") <= now_seconds < int("130200"):
                            need_cancel, cancel_msg = True, f"成交时间与本地时间相差10S以上,{l2_huaxin_util.convert_time(datas[-1][3])}"
                    if need_cancel:
                        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()
                HuaXinSellOrderStatisticManager.statistic_total_deal_volume(code, datas)
                use_time_list.append(("统计成交量数据", time.time() - _start_time))
            except Exception as e:
                async_log_util.error(logger_debug, f"卖单统计异常:{big_sell_order_info}")
                logger_debug.exception(e)
            _start_time = time.time()
            cls.__statistic_thread_pool.submit(cls.statistic_big_order_infos, code, datas, order_begin_pos)
@@ -150,13 +157,13 @@
                    cancel_result = FCancelBigNumComputer().need_cancel_for_deal_fast(code, buy_progress_index)
                    if cancel_result[0]:
                        L2TradeDataProcessor.cancel_buy(code, f"F撤:{cancel_result[1]}")
                    # if not cancel_result[0]:
                    #     try:
                    #         cancel_result = NBCancelBigNumComputer().need_cancel(code, buy_progress_index)
                    #         if cancel_result[0]:
                    #             L2TradeDataProcessor.cancel_buy(code, f"大市值无大单撤:{cancel_result[1]}")
                    #     except:
                    #         pass
                    if not cancel_result[0]:
                        try:
                            cancel_result = NBCancelBigNumComputer().need_cancel(code, buy_progress_index)
                            if cancel_result[0]:
                                L2TradeDataProcessor.cancel_buy(code, f"大市值无大单撤:{cancel_result[1]}")
                        except:
                            pass
                    if not cancel_result[0] and buy_progress_index_changed:
                        try:
@@ -165,10 +172,6 @@
                                L2TradeDataProcessor.cancel_buy(code, f"W撤:{cancel_result[1]}")
                        except:
                            pass
                    SCancelBigNumComputer().set_transaction_index(code, order_begin_pos.buy_single_index,
                                                                  buy_progress_index)