Administrator
2023-12-21 81f328532e366eef171b71810b221a9294dda78f
third_data/code_plate_key_manager.py
@@ -447,7 +447,7 @@
            jingxuan_block_info = self.__KPLCodeJXBlockManager.get_jx_blocks_cache(code, by=True)
        if jingxuan_block_info:
            jingxuan_blocks = jingxuan_block_info[0]
            k4 |= set(jingxuan_blocks)  #set([x[1] for x in jingxuan_blocks])
            k4 |= set(jingxuan_blocks)  # set([x[1] for x in jingxuan_blocks])
        for k in [k1, k11, k2, k3, k4]:
            keys |= k
@@ -525,6 +525,11 @@
                        is_strong_block = True
                        break
        if not is_strong_block:
            temp_block_codes = set(copy.deepcopy(block_codes))
            temp_block_codes.discard(code)
            if len(temp_block_codes) >= 3:
                is_strong_block = True
        max_rank = 2
        #  强势板块买老四
        if is_strong_block:
@@ -551,8 +556,10 @@
                                                                                                code_limit_up_reason_dict,
                                                                                                yesterday_current_limit_up_codes,
                                                                                                exclude_first_codes,
                                                                                                len(current_open_limit_up_codes),
                                                                                                shsz=True, limit_up_time=first_limit_up_time)
                                                                                                len(
                                                                                                    current_open_limit_up_codes),
                                                                                                shsz=True,
                                                                                                limit_up_time=first_limit_up_time)
        # record_shsz_rank, record_shsz_rank_codes = kpl_block_util.get_code_record_rank(code, block,
        #                                                                                limit_up_record_datas,
        #                                                                                code_limit_up_reason_dict,
@@ -565,6 +572,11 @@
        if current_shsz_rank < len(current_open_limit_up_codes) + max_rank:
            return True, False, f"【{block}】前排代码:{current_shsz_rank}", is_strong_block
        else:
            # 看自由流通市值是否小于20亿
            if is_strong_block and current_shsz_rank < len(current_open_limit_up_codes) + max_rank + 1:
                zyltgb = global_util.zyltgb_map.get(code)
                if zyltgb and zyltgb < 20 * 100000000:
                    return True, False, f"【{block}】强势板块 自由流通市值({zyltgb})小于20亿", is_strong_block
            return False, False, f"【{block}】前排代码:{front_current_shsz_rank_codes} 超过{len(current_open_limit_up_codes) + max_rank}个", is_strong_block
        # 过时的代码
@@ -622,7 +634,7 @@
        # 始终获取精选板块
        if True:
            # 获取
            if k4 and not keys:
            if k4:
                # 当涨停原因没有时才取精选板块
                keys |= k4
                keys = keys - constant.KPL_INVALID_BLOCKS
@@ -752,10 +764,11 @@
    # high_level_general_code_blocks 高位泛化板块
    @classmethod
    def update_can_buy_blocks(cls, code, current_limit_up_datas, limit_up_record_datas,
                              yesterday_current_limit_up_records,
                              latest_current_limit_up_records,
                              before_blocks_dict, current_limit_up_block_codes_dict):
        yesterday_current_limit_up_codes = set()
        yesterday_current_limit_up_records_dict = {}
        yesterday_current_limit_up_records = latest_current_limit_up_records[0][1]
        if yesterday_current_limit_up_records:
            for r in yesterday_current_limit_up_records:
                yesterday_current_limit_up_codes.add(r[0])
@@ -767,12 +780,15 @@
                if r[4].replace("连板", "").isdigit():
                    count = int(r[4].replace("连板", ""))
                    if count >= 3:
                        latest_datas = latest_current_limit_up_records[:count-1]
                        # 是高位板
                        # 当日精选
                        blocks = set(r[6].split("、"))
                        if r[0] in yesterday_current_limit_up_records_dict:
                            # 昨日涨停原因
                            blocks.add(yesterday_current_limit_up_records_dict.get(r[0])[5])
                        for d in latest_datas:
                            for dd in d[1]:
                                if dd[0] == r[0]:
                                    blocks.add(dd[5])
                                    break
                        f_blocks = []
                        for b in blocks:
                            if b: