Administrator
2024-11-28 23361ac1cacec70b840f497cc35d2f7a5de66387
l2/l2_data_manager_new.py
@@ -2075,45 +2075,55 @@
            limit_up_price = gpcode_manager.get_limit_up_price_as_num(code)
            bigger_money = l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code))
            min_num = int(bigger_money / limit_up_price / 100)
            # 如果有大单成交就不需要看大单
            total_deal_money = 0
            if constant.CAN_RADICAL_BUY_NEED_BIG_ORDER_EVERYTIME:
                # 每次下单都需要大单
                current_big_order_deal_money_info = EveryLimitupBigDealOrderManager.get_big_buy_deal_order_money_info(
                    code)
                if current_big_order_deal_money_info:
                    total_deal_money = current_big_order_deal_money_info[0]
                if current_big_order_deal_money_info and tool.trade_time_sub(tool.get_now_time_str(),
                                                                             current_big_order_deal_money_info[1]) > 60:
                    # 60s以上的大单不看
                    total_deal_money = 0
            else:
                # 只需要总成交的大单
                total_deal_money = BigOrderDealManager().get_total_buy_money(code)
            refer_sell_data = L2MarketSellManager().get_refer_sell_data(code, radical_data[3])
            # 参考总卖额
            refer_sell_money = 0
            if refer_sell_data:
                refer_sell_money = refer_sell_data[1]
            THRESHOLD_MONEY = 2990000
            if refer_sell_money >= 1e7:
                THRESHOLD_MONEY = 2990000 * 2
            else:
                THRESHOLD_MONEY = 2990000
            if total_deal_money >= THRESHOLD_MONEY:
            # 大单判断结果
            big_order_deal_enough_result = radical_buy_data_manager.is_big_order_deal_enough(code,
                                                                                             code_volumn_manager.CodeVolumeManager().get_volume_rate_refer_in_5days(
                                                                                                 code),
                                                                                             refer_sell_money)
            # 缺乏的大单金额
            lack_money = big_order_deal_enough_result[3]
            # 如果有大单成交就不需要看大单
            if constant.CAN_RADICAL_BUY_NEED_BIG_ORDER_EVERYTIME:
                # 每次下单都需要大单
                current_big_order_deal_money_info = EveryLimitupBigDealOrderManager.get_big_buy_deal_order_money_info(
                    code)
                if current_big_order_deal_money_info and tool.trade_time_sub(tool.get_now_time_str(),
                                                                             current_big_order_deal_money_info[1]) > 60:
                    # 60s以上就不下单了
                    return False, None, "距离上次统计大单时间过去60s", set()
            if lack_money == 0:
                min_num = int(5000 / limit_up_price)
            # 需要监听的大单
            watch_indexes = set()
            # 总委托大单金额
            total_delegating_big_money = 0
            single_index = None
            for i in range(start_index, end_index + 1):
            # 从成交进度位开始看
            trade_index, is_default = cls.__TradeBuyQueue.get_traded_index(code)
            if trade_index is None:
                trade_index = 0
            canceled_buyno_map = local_today_canceled_buyno_map.get(code)
            for i in range(trade_index, end_index + 1):
                data = total_datas[i]
                val = data["val"]
                if not L2DataUtil.is_limit_up_price_buy(val):
                    continue
                if val["num"] < min_num:
                    continue
                # 撤单不算
                left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(code, i,
                                                                                                         total_datas,
                                                                                                         canceled_buyno_map)
                if left_count == 0:
                    continue
                # 上证有可能是部分成交的大单
                if i == start_index and tool.is_sh_code(code):
                    dealing_active_order_info = HuaXinBuyOrderManager().get_dealing_active_order_info(code)
@@ -2121,9 +2131,9 @@
                        # 判断是否为大单
                        order_money = dealing_active_order_info[2] + round(val["price"], 2) * val["num"] * 100
                        if order_money >= bigger_money:
                            total_delegating_big_money += order_money
                            lack_money -= order_money
                            watch_indexes.add(i)
                            if total_delegating_big_money + total_deal_money >= THRESHOLD_MONEY:
                            if lack_money < 0:
                                single_index = i
                                break
@@ -2131,8 +2141,8 @@
                    # 主动买单后的数据不算
                    continue
                watch_indexes.add(i)
                total_delegating_big_money += round(val["price"], 2) * val["num"] * 100
                if total_delegating_big_money + total_deal_money >= THRESHOLD_MONEY:
                lack_money -= round(val["price"], 2) * val["num"] * 100
                if lack_money < 0:
                    single_index = i
                    break
            if single_index is not None: