Administrator
2025-03-31 c7c24c39ea646b612676c4b0afaa37f45cfae926
新题材修改
3个文件已修改
41 ■■■■■ 已修改文件
l2/cancel_buy_strategy.py 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/buy_radical/block_special_codes_manager.py 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/buy_radical/radical_buy_data_manager.py 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py
@@ -570,9 +570,9 @@
        #     if buy1_money:
        #         if total_num_ * limit_up_price * 100 > buy1_money * 0.65:
        #             return True, f"P撤:成交位置距离下单位置太远 成交位-{trade_index} 下单位-{real_order_index} 买1-{buy1_money}"
        min_time_s, max_time_s = 2, 30
        if total_num * limit_up_price >= 299 * 100:
            min_time_s, max_time_s = 30, 60
        min_time_s, max_time_s = 2, 60
        # if total_num * limit_up_price >= 299 * 100:
        #     min_time_s, max_time_s = 30, 60
        if sub_time <= min_time_s:
            return False, f"下单在{min_time_s}s内"
@@ -583,6 +583,7 @@
        # 计算我们后面的大单与涨停纯买额
        total_left_num = 0
        total_big_num_count = 0
        canceled_buyno_map =  local_today_canceled_buyno_map.get(code)
        for i in range(real_order_index + 1, len(total_datas)):
            data = total_datas[i]
            val = data["val"]
@@ -594,16 +595,15 @@
            left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(code,
                                                                                                     i,
                                                                                                     total_datas,
                                                                                                     local_today_canceled_buyno_map.get(
                                                                                                         code))
                                                                                                     canceled_buyno_map)
            if left_count > 0:
                if money > 299 * 100:
                if money >= min_money:
                    total_big_num_count += 1
                total_left_num += val["num"]
        left_money = total_left_num * float(limit_up_price)
        if left_money < 1000 * 100:
        if left_money < 1000 * 100 or total_big_num_count < 2:
            # 实际下单位后方所有涨停纯买额≤1000万
            return True, f"P撤:封单纯买额-{round(left_money / 100, 1)}万 大单数量-{total_big_num_count} 下单位-{real_order_index}"
            return True, f"P撤:封单纯买额-{round(left_money / 100, 1)}万 剩余大单数量-{total_big_num_count} 下单位-{real_order_index}"
        return False, "不满足撤单条件"
    # w撤
trade/buy_radical/block_special_codes_manager.py
@@ -201,10 +201,10 @@
        trading_dates = HistoryKDatasUtils.get_latest_trading_date(9)
        max_day = trading_dates[0]
        min_day = tool.date_sub(max_day, 180)
        min_day = tool.date_sub(max_day, 120)
        block_map = self.__get_block_map()
        # 统计最近180天涨停数据
        # 统计最近120天涨停数据
        # [(板块名称,代码, 日期, 是否炸板)]
        code_block_infos = self.__list_code_blocks(min_day, max_day)
@@ -248,7 +248,7 @@
            temp_data_dict[k][2] += 1
        code_block_infos = [temp_data_dict[k] for k in temp_data_dict]
        min_day = tool.date_sub(max_day, 180)
        min_day = tool.date_sub(max_day, 120)
        code_block_dict = {}  # {"代码":{"板块": 涨停次数}}
        for b in code_block_infos:
@@ -272,7 +272,7 @@
                    block_codes_dict[b] = []
                block_codes_dict[b].append((code, code_block_dict[code][b]))
        # 统计最近180天的涨停数据 {"代码": (涨停次数, 名称, 自由流通市值)}
        # 统计最近120天的涨停数据 {"代码": (涨停次数, 名称, 自由流通市值)}
        limit_up_info_map = self.__get_limit_up_info(min_day)
        fdatas = []
        for b in block_codes_dict:
@@ -291,6 +291,11 @@
            temp_codes = [x[0] for x in zylt_list]
            code_info_list.sort(key=lambda x: x[1], reverse=True)
            limit_up_count_max = code_info_list[:2]
            for i in range(2, len(code_info_list)):
                if code_info_list[i][1] == limit_up_count_max[-1][1]:
                    limit_up_count_max.append(code_info_list[i])
                else:
                    break
            rank2_codes = set()
            for d in limit_up_count_max:
                if d[1] >= 6:
@@ -369,7 +374,7 @@
    # print(datas)
    datas = AnalysisBlockSpecialCodesManager().get_block_special_codes()
    # print(datas)
    for d in datas:
        print(d)
    BlockSpecialCodesManager().set_block_codes_list(datas)
    # for d in datas:
    #     print(d)
    # BlockSpecialCodesManager().set_block_codes_list(datas)
    # print(BlockSpecialCodesManager().get_code_blocks("002582"))
trade/buy_radical/radical_buy_data_manager.py
@@ -1188,9 +1188,9 @@
                return False, f"前排辨识度>=3个({before_special_codes})"
        # 判断是净流入前排
        in_blocks = RealTimeKplMarketData.get_top_market_jingxuan_blocks()
        if block not in in_blocks:  # or in_blocks.index(block) >= constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL:
            return False, f"没有在精选净流入前{constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL}"
        # in_blocks = RealTimeKplMarketData.get_top_market_jingxuan_blocks()
        # if block not in in_blocks:  # or in_blocks.index(block) >= constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL:
        #     return False, f"没有在精选净流入前{constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL}"
        # if history_index >= 4:
        #     # 判断量是否换够