Administrator
2025-08-18 ae8d76a456b64c1c6c4ebf11b6ec33b7df217b1a
third_data/kpl_limit_up_data_manager.py
@@ -126,8 +126,8 @@
    """
    最近涨停的板块管理
    """
    # 看最近3天,不包含今天
    __LATEST_DAY_COUNT = 3
    # 看最近2天,不包含今天
    __LATEST_DAY_COUNT = 2
    __days = []
    # 目前涨停
@@ -202,7 +202,7 @@
            # 将板块所包含的代码归类
            code = h[3]
            cls.__code_name_dict[code] = h[4]
            blocks = LimitUpCodesBlockRecordManager().get_radical_buy_blocks(code)
            blocks = {h[2]} #LimitUpCodesBlockRecordManager().get_radical_buy_blocks(code)
            if blocks:
                for b in blocks:
                    if b not in block_codes_dict:
@@ -232,8 +232,8 @@
        block_codes_dict = {}
        for day in self.__block_day_datas:
            for b in self.__block_day_datas[day]:
                total_limit_up_count = self.__block_day_datas[day][b][0] + self.__block_day_datas[day][b][1]
                if total_limit_up_count < 3:
                finally_limit_up_count = self.__block_day_datas[day][b][0]
                if finally_limit_up_count < 3:
                    continue
                # 板块涨停个数
                if b not in block_count_dict:
@@ -256,8 +256,11 @@
            for day in self.__days:
                if day not in self.__block_day_datas:
                    continue
                total_limit_up_count = self.__block_day_datas[day][b][0] + self.__block_day_datas[day][b][1]
                if b in self.__block_day_datas[day] and total_limit_up_count >= 3:
                if b in self.__block_day_datas[day]:
                    finally_limit_up_count = self.__block_day_datas[day][b][0]
                else:
                    finally_limit_up_count = 0
                if b in self.__block_day_datas[day] and finally_limit_up_count >= 3:
                    # 板块代码数量>=3个
                    temp.append(day)
                else:
@@ -310,10 +313,10 @@
        if cls.__days:
            volumes_data = HistoryKDataManager().get_history_bars(code, cls.__days[1])
            if volumes_data:
                volumes_data = volumes_data[:cls.__LATEST_DAY_COUNT - 1]
                volumes_data = volumes_data[:cls.__LATEST_DAY_COUNT]
                cls.__k_datas[code] = volumes_data
        if not volumes_data:
            volumes_data = init_data_util.get_volumns_by_code(code, cls.__LATEST_DAY_COUNT - 1)
            volumes_data = init_data_util.get_volumns_by_code(code, cls.__LATEST_DAY_COUNT)
            if volumes_data:
                cls.__k_datas[code] = volumes_data
        # 获取最大涨幅
@@ -324,3 +327,11 @@
        rate = int((volumes_data[0]["close"] - min_price) * 100 / min_price)
        cls.__k_max_rate[code] = rate
        return cls.__k_datas.get(code)
if __name__ == "__main__":
    # datas = LatestLimitUpBlockManager().statistics_limit_up_block_infos()
    # print(datas)
    code = "600126"
    blocks = LimitUpCodesBlockRecordManager().get_radical_buy_blocks(code)
    print(blocks)