Administrator
2024-11-29 bac8cda4344a92e70f8e82a31f91bd74f010bee4
加红条件修改
2个文件已修改
65 ■■■■ 已修改文件
servers/huaxin_trade_server.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/buy_radical/radical_buy_data_manager.py 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
servers/huaxin_trade_server.py
@@ -834,6 +834,8 @@
                                radical_buy_data_manager.BlockPlaceOrderRecordManager().add_record(code, buy_blocks)
                                radical_buy_strategy.clear_data(code)
                                RDCancelBigNumComputer().clear_data(code)
                                # 大单成交足够
                                RadicalBuyDataManager().big_order_deal_enough(code)
                            return True
                        else:
                            RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict[code] = (
trade/buy_radical/radical_buy_data_manager.py
@@ -183,6 +183,10 @@
        if gpcode_manager.MustBuyCodesManager().is_in_cache(code):
            return
        cls.place_order_success(code)
        total_deal_big_order_result = get_total_deal_big_order_info(code,
                                                                    gpcode_manager.get_limit_up_price_as_num(code))
        if total_deal_big_order_result[0] <= 0:
            cls.big_order_deal_enough(code)
    @classmethod
    def place_order_success(cls, code):
@@ -199,7 +203,18 @@
        if gpcode_manager.MustBuyCodesManager().is_in_cache(code):
            return
        volume_rate = code_volumn_manager.CodeVolumeManager().get_volume_rate_refer_in_5days(code)
        if volume_rate and volume_rate >= 0.69:
        if volume_rate and volume_rate >= 0.39:
            gpcode_manager.MustBuyCodesManager().add_code(code)
    @classmethod
    def big_order_deal_enough(cls, code):
        """
        大单成交足够
        @param code:
        @return:
        """
        if gpcode_manager.MustBuyCodesManager().is_in_cache(code):
            return
            gpcode_manager.MustBuyCodesManager().add_code(code)
@@ -749,7 +764,8 @@
        block_codes = BlockSpecialCodesManager().get_block_codes(block)
        if not block_codes or code not in block_codes:
            return False, "无辨识度"
        history_index, history_before_codes_info = cls.__get_history_index(code, block, yesterday_limit_up_codes, ignore_open_limit_up=False)
        history_index, history_before_codes_info = cls.__get_history_index(code, block, yesterday_limit_up_codes,
                                                                           ignore_open_limit_up=False)
        if history_index > 5:
            return False, f"处于首板老{history_index + 1}"
        # if history_index >= 4:
@@ -994,6 +1010,29 @@
        return self.__codes
def get_total_deal_big_order_info(code, limit_up_price):
    """
    总成交大单啊是否足够
    @param code:
    @return:(缺少的资金,总成交金额, 要求的大单)
    """
    TOTAL_BIG_DEAL_MONEY_THRESHOLD_COUNT = round(
        code_volumn_manager.CodeVolumeManager().get_max_volume_in_5days(code) * limit_up_price / 1e8, 2)
    TOTAL_BIG_DEAL_MONEY_THRESHOLD_MONEY = TOTAL_BIG_DEAL_MONEY_THRESHOLD_COUNT * 299 * 10000
    deal_big_order_money = BigOrderDealManager().get_total_buy_money(code)
    try:
        # 获取正在成交的订单
        dealing_order_info = HuaXinBuyOrderManager().get_dealing_order_info(code)
        threshold_big_money = l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code))
        if dealing_order_info and dealing_order_info[2] >= threshold_big_money:
            # 正在成交的订单是大单
            deal_big_order_money += dealing_order_info[2]
    except Exception as e:
        async_log_util.info(logger_l2_radical_buy, f"计算正在成交大单出错:{str(e)}")
    total_lack_money = max(0, int(TOTAL_BIG_DEAL_MONEY_THRESHOLD_MONEY - deal_big_order_money))
    return total_lack_money, deal_big_order_money, TOTAL_BIG_DEAL_MONEY_THRESHOLD_MONEY
def is_big_order_deal_enough(code, volume_rate, refer_total_sell_money):
    """
    大单成交是否足够
@@ -1022,20 +1061,8 @@
    current_threshold_money = current_threshold_count * 299 * 10000
    # ==========判断总大单成交================
    TOTAL_BIG_DEAL_MONEY_THRESHOLD_COUNT = round(
        code_volumn_manager.CodeVolumeManager().get_max_volume_in_5days(code) * limit_up_price / 1e8, 2)
    TOTAL_BIG_DEAL_MONEY_THRESHOLD_MONEY = TOTAL_BIG_DEAL_MONEY_THRESHOLD_COUNT * 299 * 10000
    deal_big_order_money = BigOrderDealManager().get_total_buy_money(code)
    try:
        # 获取正在成交的订单
        dealing_order_info = HuaXinBuyOrderManager().get_dealing_order_info(code)
        threshold_big_money = l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code))
        if dealing_order_info and dealing_order_info[2] >= threshold_big_money:
            # 正在成交的订单是大单
            deal_big_order_money += dealing_order_info[2]
    except Exception as e:
        async_log_util.info(logger_l2_radical_buy, f"计算正在成交大单出错:{str(e)}")
    total_lack_money = max(0, int(TOTAL_BIG_DEAL_MONEY_THRESHOLD_MONEY - deal_big_order_money))
    total_lack_money_info = get_total_deal_big_order_info(code, limit_up_price)
    total_lack_money = total_lack_money_info[0]
    # ===========判断单次大单成交==============
    current_big_order_deal_money = 0
    current_big_order_deal_money_info = EveryLimitupBigDealOrderManager.get_big_buy_deal_order_money_info(code)
@@ -1047,8 +1074,8 @@
            current_big_order_deal_money = current_big_order_deal_money_info[0]
    current_lack_money = max(0, int(current_threshold_money - current_big_order_deal_money))
    if total_lack_money == 0 and current_lack_money == 0:
        return True, f"量比-{volume_rate}, 瞬时大单成交-({current_big_order_deal_money}/{current_threshold_money}),总大单成交-({deal_big_order_money}/{TOTAL_BIG_DEAL_MONEY_THRESHOLD_MONEY})", before_time, 0
    return False, f"量比-{volume_rate}, 瞬时大单成交-({current_big_order_deal_money}/{current_threshold_money}),总大单成交-({deal_big_order_money}/{TOTAL_BIG_DEAL_MONEY_THRESHOLD_MONEY})", before_time, max(
        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 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)