Administrator
2025-04-22 0a99d6aeec309b658786a403774c0e65fd97740e
L2成交判断炸板优化/累计成交大单足够后每次上板金额最小值更改
4个文件已修改
39 ■■■■■ 已修改文件
constant.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_transaction_data_processor.py 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/buy_radical/radical_buy_data_manager.py 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constant.py
@@ -172,7 +172,7 @@
G_CANCEL_RATE_FOR_GOOD_MARKET = 0.59
# 华鑫L2的卡位数量
HUAXIN_L2_MAX_CODES_COUNT = 75
HUAXIN_L2_MAX_CODES_COUNT = 40
TRADE_WAY_HUAXIN = "huaxin"
TRADE_WAY_JUEJIN = "juejin"
l2/l2_data_manager_new.py
@@ -1949,6 +1949,7 @@
            refer_sell_money = 0
            if refer_sell_data:
                refer_sell_money = refer_sell_data[1]
            # 判断还需大单的金额(max(每次上板大单,累计成交大单))
            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),
@@ -1972,6 +1973,9 @@
                if not tool.is_sh_code(code):
                    # 非上证的票看50w
                    min_num = int(5000 / limit_up_price)
            # 如果累计大单成交足够,只需看50w
            if big_order_deal_enough_result[4]:
                min_num = int(5000 / limit_up_price)
            # 需要监听的大单
            watch_indexes = set()
            # 总委托大单金额
@@ -2018,8 +2022,8 @@
                    single_index = i
                    break
            if single_index is not None:
                return True, single_index, "有大单", watch_indexes
            return False, None, f"大单不足:{trade_index}-{end_index}  缺少的大单-{lack_money}", watch_indexes
                return True, single_index, f"有大单,大单情况:{big_order_deal_enough_result[1]}", watch_indexes
            return False, None, f"大单不足:{trade_index}-{end_index}  缺少的大单-{lack_money}  大单情况:{big_order_deal_enough_result[1]}", watch_indexes
        radical_data = RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict.get(code)
        record_codes = radical_buy_data_manager.BlockPlaceOrderRecordManager().get_codes()
@@ -2040,7 +2044,7 @@
                return False, None, "超过生效时间"
        result = __can_order()
        l2_log.debug(code, f"L2扫入判断:{result}")
        l2_log.debug(code, f"L2扫入判断({start_index}-{end_index}):{result}")
        if result[0]:
            # 已经扫入下过单且允许板上放量扫入的就需要判断板上放量的距离
            if is_radical_buy and constant.CAN_RADICAL_BUY_AT_LIMIT_UP:
l2/l2_transaction_data_processor.py
@@ -33,6 +33,8 @@
class HuaXinTransactionDatasProcessor:
    __statistic_thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=constant.HUAXIN_L2_MAX_CODES_COUNT + 2)
    __TradeBuyQueue = transaction_progress.TradeBuyQueue()
    # 非涨停成交时间
    __not_limit_up_time_dict = {}
    # 计算成交进度
    @classmethod
@@ -155,11 +157,19 @@
        try:
            current_price_process_manager.set_trade_price(code, fdatas[-1][0][1])
            if not fdatas[-1][2]:
                # 没有涨停
                EveryLimitupBigDealOrderManager.open_limit_up(code, f"最新成交价:{fdatas[-1][0][1]}")
                radical_buy_strategy.clear_data(code, msg=f"没有涨停:{fdatas[-1][0]}")
        except:
            pass
                if code not in cls.__not_limit_up_time_dict:
                    cls.__not_limit_up_time_dict[code] = fdatas[-1][5]
                last_time = cls.__not_limit_up_time_dict[code]
                # 炸板时间持续500ms以上算炸板
                if tool.trade_time_sub_with_ms(fdatas[-1][5], last_time) > 500:
                    # 没有涨停
                    EveryLimitupBigDealOrderManager.open_limit_up(code, f"最新成交价:{fdatas[-1][0][1]}")
                    radical_buy_strategy.clear_data(code, msg=f"没有涨停:{fdatas[-1][0]}")
            else:
                if code in cls.__not_limit_up_time_dict:
                    cls.__not_limit_up_time_dict.pop(code)
        except Exception as e:
            async_log_util.error(logger_debug, f"L2成交开板计算错误:{str(e)}")
        total_datas = l2_data_util.local_today_datas.get(code)
        use_time_list = []
trade/buy_radical/radical_buy_data_manager.py
@@ -1651,6 +1651,7 @@
    #     # 首次上板买入,大单阈值打3折
    #     TOTAL_BIG_DEAL_MONEY_THRESHOLD_MONEY //= 3
    # 买大单, 上板前买大单, 卖大单, 上板前卖大单
    big_order_detail_info = get_total_detal_big_order_details(code)
    deal_big_order_money = big_order_detail_info[0] + big_order_detail_info[1] - big_order_detail_info[2] - \
                           big_order_detail_info[3]
@@ -1675,7 +1676,7 @@
    @param code:
    @param volume_rate:
    @param for_buy: 是否是下单
    @return: 大单是否足够, 原因, 是否是短时生效, 还差的金额
    @return: 大单是否足够, 原因, 是否是短时生效, 还差的金额, 累计大单是否足够
    """
    limit_up_price = gpcode_manager.get_limit_up_price_as_num(code)
    refer_volume = code_volumn_manager.CodeVolumeManager().get_radical_buy_refer_volume(code, limit_up_price)
@@ -1753,9 +1754,9 @@
        if total_lack_money < 0:
            total_lack_money = 0
    if current_lack_money == 0 and total_lack_money == 0:
        return True, f"量比-{volume_rate}, 瞬时大单成交-({current_big_order_deal_money}/{current_threshold_money}),总大单成交-({total_lack_money_info[1]}/{total_lack_money_info[2]})", before_time, 0
        return True, f"量比-{volume_rate}, 瞬时大单成交-({current_big_order_deal_money}/{current_threshold_money}),总大单成交-({total_lack_money_info[1]}/{total_lack_money_info[2]})", before_time, 0, total_lack_money <=0
    return False, f"量比-{volume_rate}, 瞬时大单成交-({current_big_order_deal_money}/{current_threshold_money}),总大单成交-({total_lack_money_info[1]}/{total_lack_money_info[2]})", before_time, max(
        current_lack_money, total_lack_money)
        current_lack_money, total_lack_money), total_lack_money<=0
class EveryLimitupBigDealOrderManager: