Administrator
2024-01-19 a00da3062c6c825b585f82275823ac45cdeb6502
l2/l2_transaction_data_manager.py
@@ -10,7 +10,8 @@
from db.redis_manager_delegate import RedisUtils
from l2 import l2_data_util, l2_data_manager, transaction_progress, l2_data_source_util
from l2.cancel_buy_strategy import LCancelRateManager, LCancelBigNumComputer, \
    SecondCancelBigNumComputer, HourCancelBigNumComputer, FastCancelBigNumComputer, UCancelBigNumComputer
    SecondCancelBigNumComputer, HourCancelBigNumComputer, \
    GCancelBigNumComputer, FCancelBigNumComputer
from l2.l2_data_manager_new import L2TradeDataProcessor
from l2.l2_data_util import L2DataUtil, local_today_canceled_buyno_map
from log_module import async_log_util
@@ -115,6 +116,26 @@
            order_begin_pos = l2_data_manager.TradePointManager().get_buy_compute_start_data_cache(code)
            if order_begin_pos and order_begin_pos.buy_exec_index and order_begin_pos.buy_exec_index > -1:
                # 已经下单的需要统计F撤
                try:
                    for d in datas:
                        if FCancelBigNumComputer().need_cancel(d)[0]:
                            L2TradeDataProcessor.cancel_buy(code, f"F撤撤单:{d}")
                            order_begin_pos = None
                            break
                except Exception as e:
                    async_log_util.error(hx_logger_l2_debug, str(e))
                try:
                    for d in datas:
                        if LCancelBigNumComputer().add_transaction_data(d)[0]:
                            L2TradeDataProcessor.cancel_buy(code, f"L后成交太快撤单:{d}")
                            order_begin_pos = None
                            break
                except Exception as e:
                    async_log_util.error(hx_logger_l2_debug, str(e))
            # 计算已经成交的大单
            big_money_count = 0
            for d in datas:
@@ -122,6 +143,7 @@
                buy_num = None
                if data:
                    buy_num = data["val"]["num"] * 100
                # 统计成交单
                deal_info = self.__statistic_deal_desc(code, d, buy_num)
                if deal_info and deal_info[1]:
                    data = buyno_map.get(f"{deal_info[0]}")
@@ -144,9 +166,10 @@
                async_log_util.info(logger_l2_trade_buy_queue, "获取成交位置成功: code-{} index-{}", code,
                                    buy_progress_index)
                GCancelBigNumComputer().set_trade_progress(code, order_begin_pos.buy_single_index, buy_progress_index)
                LCancelBigNumComputer().set_trade_progress(code, order_begin_pos.buy_single_index, buy_progress_index,
                                                           total_datas)
                FastCancelBigNumComputer().set_trade_progress(code, buy_progress_index)
                SecondCancelBigNumComputer().set_transaction_index(
                    code,
                    buy_progress_index)