From 57d3daa6d8edeba3b7b01ff9b1bfce8286b39583 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 08 十二月 2023 19:37:09 +0800 Subject: [PATCH] 独苗不下单/高位板看泛化板块 --- third_data/code_plate_key_manager.py | 71 ++++++++++++++++++++++++++++++----- 1 files changed, 61 insertions(+), 10 deletions(-) diff --git a/third_data/code_plate_key_manager.py b/third_data/code_plate_key_manager.py index b411f39..7caaf9f 100644 --- a/third_data/code_plate_key_manager.py +++ b/third_data/code_plate_key_manager.py @@ -492,13 +492,21 @@ # 杩斿洖鍐呭(鏄惁鍙拱, 鏄惁涓虹嫭鑻�, 鎻忚堪淇℃伅) @classmethod def __is_block_can_buy(cls, code, block, current_limit_up_datas, code_limit_up_reason_dict, - yesterday_current_limit_up_codes, limit_up_record_datas, current_limit_up_block_codes_dict): + yesterday_current_limit_up_codes, limit_up_record_datas, current_limit_up_block_codes_dict, + high_level_code_blocks=None, high_level_block_codes=None): # 鐙嫍鍒ゆ柇 + if high_level_code_blocks is None: + high_level_code_blocks = {} + if high_level_block_codes is None: + high_level_block_codes = {} block_codes = current_limit_up_block_codes_dict.get(block) if not block_codes: - return False, True, f"{block}:鏉垮潡鏃犳定鍋�", False + # 楂樹綅鏉挎硾鍖栨澘鍧椾腑鏃犳澘鍧� + if not high_level_block_codes.get(block): + return False, True, f"{block}:鏉垮潡鏃犳定鍋�", False elif len(block_codes) == 1 and code in block_codes: - return False, True, f"{block}:鏉垮潡鍙湁褰撳墠浠g爜娑ㄥ仠", False + if not high_level_block_codes.get(block): + return False, True, f"{block}:鏉垮潡鍙湁褰撳墠浠g爜娑ㄥ仠", False # 鍙互涔扮殑鏈�澶ф帓鍚� # open_limit_up_codes = kpl_block_util.get_shsz_open_limit_up_codes(code, block, limit_up_record_datas, # code_limit_up_reason_dict) @@ -509,7 +517,10 @@ is_strong_block = False for d in current_limit_up_datas: if d[5] != block: - continue + general_blocks = high_level_code_blocks.get(d[0]) + if not general_blocks or block not in general_blocks: + # 娌″湪娉涘寲鏉垮潡涓� + continue if d[4].find("杩炴澘") > 0: if d[4].replace("杩炴澘", "").isdigit(): count = int(d[4].replace("杩炴澘", "")) @@ -583,7 +594,8 @@ @classmethod def get_can_buy_block(cls, code, current_limit_up_datas, limit_up_record_datas, yesterday_current_limit_up_codes, - before_blocks_dict, current_limit_up_block_codes_dict): + before_blocks_dict, current_limit_up_block_codes_dict, high_level_general_code_blocks, + high_level_general_block_codes): # 鍔犺浇娑ㄥ仠浠g爜鐨勭洰鏍囨澘鍧� def load_code_block(): if limit_up_record_datas: @@ -627,7 +639,9 @@ code_limit_up_reason_dict, yesterday_current_limit_up_codes, limit_up_record_datas, - current_limit_up_block_codes_dict) + current_limit_up_block_codes_dict, + high_level_code_blocks=high_level_general_code_blocks, + high_level_block_codes=high_level_general_block_codes) fresults.append((block, can_buy, unique, msg, is_strong)) return fresults, keys @@ -646,10 +660,20 @@ @classmethod def __compute_can_buy_blocks(cls, code, current_limit_up_datas, limit_up_record_datas, yesterday_current_limit_up_codes, before_blocks_dict, - current_limit_up_block_codes_dict): + current_limit_up_block_codes_dict, high_level_general_code_blocks): + # 鏍规嵁浠g爜娉涘寲鏉垮潡鑾峰彇娉涘寲鏉垮潡鐨勪唬鐮侀泦鍚� + high_level_general_block_codes = {} + for c in high_level_general_code_blocks: + blocks = high_level_general_code_blocks[c] + for b in blocks: + if b not in high_level_general_block_codes: + high_level_general_block_codes[b] = set() + high_level_general_block_codes[b].add(c) blocks_compute_results, keys = cls.get_can_buy_block(code, current_limit_up_datas, limit_up_record_datas, yesterday_current_limit_up_codes, - before_blocks_dict, current_limit_up_block_codes_dict) + before_blocks_dict, current_limit_up_block_codes_dict, + high_level_general_code_blocks, + high_level_general_block_codes) if not blocks_compute_results: return False, True, f"娌℃湁鎵惧埌鏉垮潡", [], keys codes_delegate = set(cls.__CodesTradeStateManager.get_codes_by_trade_states_cache( @@ -723,16 +747,43 @@ return can_buy_blocks, False, ",".join(msg_list), can_buy_strong_blocks, keys # 鏇存柊浠g爜鏉垮潡鍒ゆ柇鏄惁鍙互涔扮殑缁撴灉 + # 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_codes, + yesterday_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 = {} + if yesterday_current_limit_up_records: + for r in yesterday_current_limit_up_records: + yesterday_current_limit_up_codes.add(r[0]) + yesterday_current_limit_up_records_dict[r[0]] = r + high_level_general_code_blocks = {} + # 鏄惁鏄�3鏉垮強浠ヤ笂鐨勯珮浣嶆澘 + for r in current_limit_up_datas: + if r[4].find("杩炴澘") > 0: + if r[4].replace("杩炴澘", "").isdigit(): + count = int(r[4].replace("杩炴澘", "")) + if count >= 3: + # 鏄珮浣嶆澘 + # 褰撴棩绮鹃�� + 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]) + f_blocks = [] + for b in blocks: + if b: + f_blocks.append(b) + high_level_general_code_blocks[r[0]] = f_blocks + can_buy_blocks, unique, msg, can_buy_strong_blocks, keys = cls.__compute_can_buy_blocks(code, current_limit_up_datas, limit_up_record_datas, yesterday_current_limit_up_codes, before_blocks_dict, - current_limit_up_block_codes_dict) + current_limit_up_block_codes_dict, + high_level_general_code_blocks) # 淇濆瓨鏉垮潡璁$畻缁撴灉 cls.__can_buy_compute_result_dict[code] = (can_buy_blocks, unique, msg, can_buy_strong_blocks, keys) -- Gitblit v1.8.0