From e8a2356cf59b3865414078d323893ce3a898eb99 Mon Sep 17 00:00:00 2001
From: admin <admin@example.com>
Date: 星期三, 09 四月 2025 14:33:18 +0800
Subject: [PATCH] 整理 kpl_api 将其中的函数 分流到其他模块 整理data_cache中的时间字符串 新增计算市场分布形态因子 函数【未调用】

---
 strategy/kpl_api.py | 1017 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 507 insertions(+), 510 deletions(-)

diff --git a/strategy/kpl_api.py b/strategy/kpl_api.py
index cd91466..958d8a4 100644
--- a/strategy/kpl_api.py
+++ b/strategy/kpl_api.py
@@ -10,10 +10,9 @@
 import requests
 
 import constant
-from log_module import async_log_util
 from log_module.log import logger_common, logger_kpl_jingxuan_in, logger_Overall_market_strength_score, \
     logger_stock_of_markets_plate, logger_debug
-# import requests
+
 from strategy import data_cache
 from strategy import basic_methods
 from strategy.kpl_data_manager import KPLStockOfMarketsPlateLogManager
@@ -185,8 +184,6 @@
     return json.dumps({"errcode": 0, "list": fresults})
 
 
-
-
 # 鑾峰彇娑ㄥ仠淇℃伅鏁版嵁
 def get_limit_up_info():
     # 鑾峰彇娑ㄥ仠淇℃伅鍒楄〃
@@ -239,510 +236,510 @@
 
 # --------------------------------------------------------------------------------------------------------------------------------------------------------------
 
-
-# 鑾峰彇琛屾儏绮鹃�夋澘鍧� 寮哄害鎺掑悕
-def get_market_sift_plate_its_stock_power():
-    @dask.delayed
-    def batch_get_plate_codes(fs):
-        return fs
-
-    @dask.delayed
-    def request_plate_codes(i):
-        plate_name = i[1]
-        log_data = None
-        its_stock = json.loads(getCodesByPlate(i[0]))
-        now_time_str = tool.get_now_time_str()
-        if data_cache.OPENING_TIME < now_time_str < data_cache.NOON_MARKET_TIME:
-            log_data = {plate_name: its_stock['list']}
-        # 灏濊瘯杩囨护鎺夋棤鎰忎箟鐨勬蹇垫澘鍧�(plate_name not in ['绉戝垱鏉�', '鍖椾氦鎵�', '娆℃柊鑲�', '鏃�', 'ST鏉垮潡', 'ST鎽樺附', '骞惰喘閲嶇粍', '鍥戒紒鏀归潻','瓒呰穼', '澹宠祫婧�', '鑲℃潈杞', '閫佽浆濉潈']) and '澧為暱' in plate_name
-        if (plate_name not in ['绉戝垱鏉�', '鍖椾氦鎵�', '娆℃柊鑲�', '鏃�', 'ST鏉垮潡', 'ST鎽樺附', '骞惰喘閲嶇粍', '鍥戒紒鏀归潻', '瓒呰穼',
-                               '澹宠祫婧�', '鑲℃潈杞', '閫佽浆濉潈']) or ('澧為暱' in plate_name):
-
-            # print(f"{i[1]} 寮哄害:{i[2]}")
-            # 閫氳繃鏉垮潡ID鑾峰彇鍏朵笅闈㈢殑涓偂寮哄害鍒楄〃
-            # print(f"======={i[0]}=======")
-
-            # its_stock_list_info = its_stock['list']
-            # logger.info(f"its_stock_list_info==={its_stock_list_info}")
-            # 灏嗘澘鍧楀己搴︿笅闈㈠搴旂殑涓偂鍒楄〃鎵撳嵃鍒版棩蹇椾腑
-            # for i in its_stock_list_info:
-            #     if i[0] != 1:
-            #         logger.info(
-            #             f"l === 涓偂浠g爜锛歿i[0]}锛屽叕鍙稿悕绉帮細{i[1]}锛屼富鍔涜祫閲戞帹娴嬶細{i[2]}锛屾湭鐭�0鍊硷細{i[3]}锛屾蹇碉細{i[4]}锛屾渶鏂颁环锛歿i[5]}锛屽綋鏃ュ綋鏃舵定骞咃細{i[6]}%锛�"
-            #             f"鎴愪氦棰濓細{round(i[7] / 100000000, 2)} 浜匡紝瀹為檯鎹㈡墜鐜囷細{i[8]}%锛屾湭鐭�0鍊硷細{i[9]}锛屽疄闄呮祦閫氾細{round(i[10] / 100000000, 2)}浜匡紝"
-            #             f"涓诲姏涔帮細{round(i[11] / 100000000, 2)}浜匡紝"
-            #             f"涓诲姏鍗栵細{round(i[12] / 100000000, 2)}浜匡紝"
-            #             f"涓诲姏鍑�棰濓細{round(i[13] / 10000, 2)}涓囷紝涔版垚鍗犳瘮锛歿i[14]}%锛屽崠鎴愬崰姣旓細{i[15]}%锛屽噣鎴愬崰姣旓細{i[16]}%锛屼拱娴佸崰姣旓細{i[17]}%锛屽崠娴佸崰姣旓細{i[18]}%锛屽噣娴佸崰姣旓細{i[19]}%锛�"
-            #             f"鍖洪棿娑ㄥ箙锛歿i[20]}%锛岄噺姣旓細{i[21]}锛屾湭鐭�0锛歿i[22]}锛屼笂鏉挎儏鍐碉細{i[23]}锛屼笂鏉挎帓鍚嶏細{i[24]}锛屾崲鎵嬬巼锛歿i[25]}%锛�"
-            #             f"鏈煡绌哄�硷細{i[26]}锛屾湭鐭ラ浂鍊硷細{i[27]}锛屾敹鐩樺皝鍗曪細{i[28]}锛屾渶澶у皝鍗曪細{i[29]}锛屾湭鐭ョ┖鍊硷紵锛歿i[30]}锛�"
-            #             f"锛燂細{i[30]}%锛岋紵锛歿i[31]}锛岋紵锛燂細{i[32]}锛屾尟骞咃細{i[33]}%锛屾湭鐭�0锛燂紵锛燂紵锛歿i[34]}锛屾湭鐭�0锛燂紵锛燂紵锛燂細{i[35]}锛�"
-            #             f"锛�=锛歿i[36]}锛岋紵鎬诲競鍊硷細{i[37]}锛岋紵娴侀�氬競鍊硷細{i[38]}锛屾渶缁堝綊灞炴蹇碉紙鏀剁洏鍚庡嚭鏁版嵁锛燂級锛歿i[39]}锛岄娑ㄦ鏁帮細{i[40]}锛�"
-            #             f"41鏈煡1鍊硷細{i[41]}锛岀涓夊搴︽満鏋勬寔浠撱�恠tr鏁版嵁鍕跨敤杩愮畻绗︺�戯細{i[42]}涓囷紝锛熷勾棰勬祴鍑�鍒╂鼎锛歿i[43]}锛屼笂骞撮娴嬪噣鍒╂鼎锛歿i[44]}锛屽勾鍐呴娴嬪噣鍒╂鼎锛歿i[45]}"
-            #         )
-
-            # 鍒濆鍖栬偂绁ㄥ己搴﹀垪琛�
-            stock_power_list = []
-            for s in its_stock['list']:
-                # 杩囨护鎺夋定骞呭ぇ浜�  and s[6] < 6.5 涓斿皬浜�0%鐨� 鍜� 鍚嶇О涓寘鍚玈T鐨� 鍜� 娑ㄩ�熷皬浜庣瓑浜�0%鐨� 鍜� 鍙鏄ㄦ棩鏈定鍋� 鍜� 涓婅瘉鎴栨繁璇佺殑姝h偂    and s[9] > 0.0025
-                if s[6] > 0 and s[1].find("ST") < 0 and s[1].find("XD") < 0 and s[23].find("鏉�") < 0 and s[24].find("鏉�") < 0 and (s[0].startswith('60') or s[0].startswith('00')) and s[9] > 1:
-                    # print(f"{s[1]}锛屼釜鑲′唬鐮侊細{s[0]}锛�   娑ㄥ箙锛歿s[6]}%   娑ㄩ�燂細{s[9]}%   姒傚康锛歿s[4]}   涓诲姏璧勯噾鎺ㄦ祴锛歿s[2]}   棰嗘定娆℃暟锛歿s[40]}  浠婃棩绗嚑鏉匡細{s[23]} 鏄惁鐮寸増{s[24]}")
-                    # 瀵逛釜鑲″己搴� 涓昏 灞炴�у垪琛ㄨ繘琛岃濉�
-                    its_stock_power = [s[1], s[0], s[6], s[9], s[4], s[2], s[40]]
-                    # 閫愪釜閫夋嫨鎬ф坊鍔爄ts_stock涓殑鍏冪礌鍒颁釜鑲″己搴﹀垪琛ㄤ腑
-                    # print(f"its_stock_power===={its_stock_power}")
-                    # 鏁翠綋灏嗘坊鍔犲畬鍠勭殑涓偂寮哄害鍒楄〃娣诲姞鍒拌偂绁ㄥ垪琛ㄤ腑
-                    stock_power_list.append(its_stock_power)
-            # print(f"stock_power_list===={stock_power_list}")
-            # 杩囨护鎺夋病鏈夌灛鏃堕珮寮哄害涓偂鐨勭┖姒傚康
-            if len(stock_power_list) != 0:
-                # 灏嗗搴旀澘鍧楃殑鑲$エ寮哄害鍒楄〃鏂板缓涓�涓瓧鍏�
-                stock_power_item = {i[1]: stock_power_list}
-                # 骞舵洿鏂板埌绮鹃�夋澘鍧椾釜鑲″瓧鍏镐腑
-                market_sift_plate_stock_dict.update(stock_power_item)
-        return log_data
-
-    data = (getMarketJingXuanRealRankingInfo())
-    market_sift_plate = json.loads(data)
-    # logger_kpl_jingxuan_in 鎵撳嵃鐨勬棩蹇椾笓鐢ㄤ簬寮�鐩樹簡鏁版嵁鐨勫瓨鍌ㄥ垎鏋愶紝涓嶈兘杞绘槗鍒犻櫎
-    # print(f"market_sift_plate 鏁� ======{len(market_sift_plate['list'])}")
-    # 琛屾儏銆嬬簿閫夋澘鍧椼�嬫帓鍚嶅墠20涓�嬪搴斾釜鑲°�嬬鍚堟潯浠剁殑涓偂
-    # logger.info(f"market_sift_plate['list']======{market_sift_plate['list']}")
-    # logger.info(f"market_sift_plate['list'][0]  ======{market_sift_plate['list'][0]}")
-    # 鍒濆鍖栫簿閫夋澘鍧楀搴斾釜鑲″瓧鍏�
-    market_sift_plate_stock_dict = {}
-    if 'list' in market_sift_plate:
-        ds = []
-        for d in market_sift_plate['list']:
-            ds.append(request_plate_codes(d))
-        dask_result = batch_get_plate_codes(ds)
-        compute_results = dask_result.compute()
-        log_datas = {}
-        for r in compute_results:
-            if not r:
-                continue
-            for b in r:
-                log_datas[b] = r[b]
-        now_time = tool.get_now_time_str()
-        if data_cache.L1_DATA_START_TIME < now_time < data_cache.NOON_MARKET_TIME:
-            # logger.info(f"绮鹃�夋澘鍧楄偂绁ㄥ己搴︽暟鎹洿鏂� == {market_sift_plate_stock_dict}")
-            # 鍙湪鐩樹腑鏃堕棿鑾峰彇
-            KPLStockOfMarketsPlateLogManager().add_log(market_sift_plate['list'], log_datas)
-
-    return market_sift_plate_stock_dict
-
-
-# 璋冪敤涓�涓嬭幏鍙栫簿閫夋澘鍧楄偂绁ㄥ己搴︽暟鎹嚱鏁�  銆愭湰妯″潡鍐呬娇鐢ㄦ椂璋冪敤銆�
-# get_market_sift_plate_its_stock_power()
-
-def get_market_sift_plate_its_stock_power_process(callback):
-    while True:
-        try:
-            # now = time.time()
-            # print(f"kpl_limit_up_process寮�濮嬩簡{now}")
-            start_time = time.time()
-            now_time = tool.get_now_time_str()
-            if data_cache.L1_DATA_START_TIME < now_time < data_cache.CLOSING_TIME:
-                its_stock_power = get_market_sift_plate_its_stock_power()
-                time_str = datetime.datetime.now().strftime("%H%M%S")
-                if 92900 < int(time_str) < 95000:
-                    logger_kpl_jingxuan_in.info(f"鑰楁椂锛歿time.time() - start_time}  鏁版嵁锛歿its_stock_power}")
-                callback(its_stock_power)
-                # print(f"绮鹃�夋澘鍧楁媺鍗囦釜鑲℃洿鏂�===={its_stock_power}")
-        except Exception as e:
-            logger_debug.exception(e)
-            logger.error(f"寮�鐩樺暒鏉垮潡寮哄害绾跨▼鎶ラ敊An error occurred: {e}")
-        finally:
-            time.sleep(2)
-
-
-# 鑾峰彇娑ㄥ仠鏉垮潡鍚嶇О鍒楄〃骞跺瓨鍌ㄦ湰鍦扮殑鍑芥暟
-def get_limit_up_block_names():
-    # 璁惧畾褰撳墠鏃堕棿鐐�
-    now_time = tool.get_now_time_str()
-    # print(f"now_time===={now_time}")
-    if data_cache.SERVER_RESTART_TIME < now_time < data_cache.UPDATE_DATA_TIME:
-        # print(f"鍦ㄦ椂闂村唴浣跨敤--------------------------")
-        # 鑾峰彇娑ㄥ仠淇℃伅鍒楄〃
-        limit_up_info = get_limit_up_info()
-        # print(f"limit_up_info=={limit_up_info}")
-        data_cache.limit_up_info = get_limit_up_info()
-        # 鎻愬彇娑ㄥ仠鍒楄〃涓殑鏉垮潡鍚嶇О
-        limit_up_block_names = []
-        # 寰幆娣诲姞娑ㄥ仠姒傚康
-        for i in limit_up_info:
-            limit_up_block_names.append(i[5])
-        # print(f"limit_up_block_names==={limit_up_block_names}")
-        # return limit_up_block_names
-        # # 浣跨敤Counter璁$畻姣忎釜鍏冪礌鐨勫嚭鐜版鏁�
-        # counter = Counter(limit_up_block_names)
-        # # 鎵惧嚭鍑虹幇娆℃暟鏈�澶氱殑鍏冪礌鍙婂叾娆℃暟
-        # most_common_element, most_common_count = counter.most_common(1)[0]
-        # # 鎵撳嵃鍑虹幇娆℃暟鏈�澶氱殑鍏冪礌
-        # print(f"涓荤嚎姒傚康锛歿most_common_element}锛屽嚭鐜颁簡 {most_common_count} 娆�")
-
-        return limit_up_block_names
-
-
-# 涓哄紑鐩樺暒鎺ュ彛鑾峰彇鐨勬定鍋滃垪琛ㄦ蹇垫澘鍧楀崟鐙紑涓�涓繘绋�  褰㈠弬(callback)
-def kpl_limit_up_process(callback):
-    while True:
-        try:
-            # now = time.time()
-            # print(f"kpl_limit_up_process寮�濮嬩簡{now}")
-            limit_up_block_names = get_limit_up_block_names()
-            callback(limit_up_block_names)
-            # logger.info(f"娑ㄥ仠鏇存柊===={limit_up_block_names}")
-            # print(f"娑ㄥ仠鏇存柊鏁伴噺===={len(limit_up_block_names)}")
-            # print(f"kpl_limit_up_process瀹屾垚涓�涓媨now}")
-        except Exception as e:
-            logger.error(f"寮�鐩樺暒娑ㄥ仠鏉垮潡姒傚康绾跨▼鎶ラ敊An error occurred: {e}")
-        finally:
-            time.sleep(1.5)
-
-
-# kpl_limit_up_process()
-
-
-# 鏋勫缓娑ㄥ仠淇℃伅璇诲啓瀵硅薄
-class DailyLimitUpInfoStorageManager:
-    # 鍒濆鍖栨枃浠惰矾寰�
-    def __init__(self, file_path=constant.KPL_LIMIT_UP_DATA_PATH):
-        self.file_path = file_path
-
-    # 娣诲姞鍗曟棩娑ㄥ仠淇℃伅鏁版嵁鍒版枃浠朵腑鐨勪竴琛� 鍑芥暟
-    def append_data_to_file(self, data_to_append):
-        # print(f"data_to_append=={data_to_append}")
-        # 璇诲彇鎵�鏈夎骞惰В鏋愪负 JSON 瀵硅薄鍒楄〃
-        if os.path.exists(self.file_path):
-            with open(self.file_path, 'r', encoding='utf-8') as file:
-                # 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲
-                current_date = datetime.datetime.now().strftime('%Y-%m-%d')
-                lines = [json.loads(line.strip()) for line in file if line.strip()]
-                # print(f"lines type=={type(lines)}")
-                # print(f"lines=={lines}")
-                # 妫�鏌ュ綋鍓嶆棩鏈熸槸鍚﹀凡瀛樺湪浜庢枃浠朵腑
-                if lines:  # 濡傛灉璇诲彇鍒扮殑琛屾枃浠跺垪琛ㄤ笉涓虹┖锛堜负鐪燂級
-                    if lines[-1].get(current_date) is None:  # 濡傛灉鍒楄〃涓殑鍊掓暟鏈�鍚庝竴琛岃幏鍙栦笉鍒板綋鏃ョ殑鏃ユ湡锛堟渶鍚庝竴琛岀殑閿� 涓� 褰撴棩鏃ユ湡锛�
-                        # 灏嗘棩鏈熷拰data_to_append杞崲涓篔SON鏍煎紡鐨勫瓧绗︿覆
-                        json_line = json.dumps({current_date: data_to_append}, ensure_ascii=False) + '\n'
-                        # 鎵撳紑鏂囦欢骞惰拷鍔燡SON琛�
-                        with open(self.file_path, 'a', encoding='utf-8') as file:
-                            file.write(json_line)
-                    else:
-                        logger.info(f"锛堝綋鏃ユ棩鏈熷凡瀛樺湪浜庢枃浠剁殑鏈�鍚庝竴琛屼簡锛屼笉鍐嶉噸澶嶈拷鍔犲啓鍏ワ級")
-                else:
-                    json_line = json.dumps({current_date: data_to_append}, ensure_ascii=False) + '\n'
-                    # 鎵撳紑鏂囦欢骞惰拷鍔燡SON琛�
-                    with open(self.file_path, 'a', encoding='utf-8') as file:
-                        file.write(json_line)
-
-    # 娓呯悊澶氫綑鏁版嵁鍑芥暟
-    def check_and_remove_oldest_entry(self, max_entries):
-        # 璇诲彇鎵�鏈夎骞惰В鏋愪负 JSON 瀵硅薄鍒楄〃
-        if os.path.exists(self.file_path):
-            with open(self.file_path, 'r', encoding='utf-8') as file:
-                lines = [json.loads(line.strip()) for line in file if line.strip()]
-        else:
-            lines = []
-
-            # 濡傛灉琛屾暟瓒呰繃闄愬埗锛岀Щ闄ゆ渶鏃╃殑涓�浜涜
-        if len(lines) >= max_entries:
-            # 鎴柇鍒楄〃锛屽彧淇濈暀鏈�鏂扮殑 max_entries 涓璞�
-            lines = lines[-max_entries:]
-            # 閲嶆柊鎵撳紑鏂囦欢浠ュ啓鍏ユā寮忥紝骞跺啓鍏ユ埅鏂悗鐨勫璞″垪琛ㄤ负 JSON Lines
-            with open(self.file_path, 'w', encoding='utf-8') as file:
-                for obj in lines:
-                    file.write(json.dumps(obj, ensure_ascii=False) + '\n')
-                    # file.write(json.dumps(obj, ensure_ascii=False))
-
-    # 闅旇鏁寸悊鏁版嵁骞跺悎骞惰鍏ヤ竴涓瓧鍏告暟鎹腑璋冪敤鏃惰繑鍥炶繖涓瓧鍏告暟鎹� 鍑芥暟
-    def arrange_limit_up_info(self):
-        limit_info = {}
-        # 鍒涘缓涓�涓垪琛ㄦ潵瀛樺偍鎵�鏈夎В鏋愮殑 JSON 瀵硅薄
-        if os.path.exists(self.file_path):
-            with open(self.file_path, 'r', encoding='utf-8') as file:
-                for line in file:
-                    # 鍘婚櫎姣忚鏈熬鐨勬崲琛岀锛堝鏋滄湁鐨勮瘽锛�
-                    line = line.rstrip('\n')
-                    # 灏嗘瘡琛岃В鏋愪负涓�涓� JSON 瀵硅薄
-                    info = json.loads(line)
-                    # 鍋囪姣忚閮芥槸涓�涓瓧鍏告暟鎹紝涓斿彧鏈変竴涓敭鍊煎锛屽叾涓敭鏄棩鏈�
-                    if isinstance(info, dict) and len(info) == 1:
-                        date, data = list(info.items())[0]
-                        limit_info[date] = data
-        return limit_info
-
-
-# 鏋勫缓涓�涓幏鍙栬鍐欏瓨鍌ㄦ湰鍦扮殑骞舵暣鐞嗘定鍋滄暟鎹殑鍑芥暟
-def get_arrange_limit_up_info():
-    # 瀹炰緥鍖栨瘡鏃ユ定鍋滀俊鎭暣鐞嗘柟娉�
-    manager = DailyLimitUpInfoStorageManager()
-    manager.append_data_to_file(get_limit_up_info())
-    manager.check_and_remove_oldest_entry(max_entries=1000)
-
-
-# 鏋勫缓涓�涓鐞嗗巻鍙叉定鍋滄定鍋滀俊鎭暟鎹殑鍑芥暟
-def get_handling_limit_up_info():
-    # 瀹炰緥鍖栨瘡鏃ユ定鍋滀俊鎭暣鐞嗘柟娉�
-    history_limit_up_info = DailyLimitUpInfoStorageManager()
-    data_cache.daily_limit_up_info = history_limit_up_info.arrange_limit_up_info()
-    # logger.info(f"璇绘湰鍦扮殑鏃ユ洿鐨勫巻鍙叉定鍋滄暟鎹�=={data_cache.daily_limit_up_info}")
-
-    # print(f"daily_limit_up_info  绫诲瀷==={type(data_cache.daily_limit_up_info)}")
-    # 缁熻姣忔棩涓荤嚎
-    daily_limit_up_info_len = len(data_cache.daily_limit_up_info)
-    # print(f"daily_limit_up_info_len==={daily_limit_up_info_len}")
-
-    historical_transaction_date_list = []
-    date_of_the_day = data_cache.DataCache().today_date
-    for i in range(daily_limit_up_info_len):
-        pre_date = hx_qc_value_util.get_previous_trading_date(date_of_the_day)  # 鑾峰彇鍓嶄竴涓氦鏄撴棩API
-        # target_date_str = basic_methods.pre_num_trading_day(data_cache.today_date, daily_limit_up_info_len)
-        date_format = "%Y-%m-%d"
-        target_date = datetime.datetime.strptime(pre_date, date_format).strftime("%Y-%m-%d")
-        historical_transaction_date_list.append(target_date)
-        date_of_the_day = pre_date
-
-    # print(f"historical_transaction_date_list={historical_transaction_date_list}")
-    history_sorted_plate_ranking_list = []
-    for key, value in data_cache.daily_limit_up_info.items():
-        # print(f"key=={key}")
-        for i in historical_transaction_date_list:
-            # print(f"i======={i}")
-            # 鎵惧埌姣忎笂涓�涓氦鏄撴棩瀵瑰簲鐨勬湰鍦版暟鎹殑淇℃伅
-            if key == i:
-                # print(f"{key}===鎵惧埌浜嗭紒value={value}")
-                #
-                plate_ranking_list = []
-                # 閬嶅巻浜ゆ槗鏃ユ瘡涓�涓定鍋滆偂鐨勪俊鎭�
-                for v in value:
-                    # print(f"v =={v}")
-                    # 灏嗘瘡涓�涓定鍋滆偂鐨勬定鍋滄蹇靛拰鍚岀彮绾ф暟閲� 姹囩紪涓轰竴涓瓧鍏�
-                    plate_limit_up_num_dict = {
-                        v[5]: v[20]
-                    }
-                    # 灏嗚繖涓瓧鍏告暟鎹笉閲嶅鐨勬坊鍔犲埌姒傚康鎺掑悕鍒楄〃涓�
-                    if plate_limit_up_num_dict not in plate_ranking_list:
-                        plate_ranking_list.append(plate_limit_up_num_dict)
-                        # plate_ranking_set.add(v[20])
-                # print(f"plate_ranking_list={plate_ranking_list}")
-                # 浣跨敤sorted鍑芥暟鍜宭ambda琛ㄨ揪寮忔潵鏍规嵁瀛楀吀鐨勫�艰繘琛屾帓搴�
-                # 杩欓噷鎴戜滑纭繚涓嶄慨鏀瑰師濮嬪瓧鍏革紝浠呴�氳繃list(x.values())[0]鏉ヨ幏鍙栧��
-                sorted_plate_ranking_list = sorted(plate_ranking_list, key=lambda x: list(x.values())[0], reverse=True)
-                # logger.info(f"{key}=====>>>>{sorted_plate_ranking_list}")
-                history_sorted_plate_ranking_list.append(sorted_plate_ranking_list)
-
-    # print(f"history_sorted_plate_ranking_list={history_sorted_plate_ranking_list}")
-    # for ranking_list in history_sorted_plate_ranking_list:
-    #     print(f"ranking_list={ranking_list}")
-    #     for i in ranking_list:
-    #         print(f"i={i}")
-
-    # 璁$畻鍘嗗彶娑ㄥ仠姒傚康鐨勮繛缁嚭鐜版鏁板嚱鏁�
-    def count_key_occurrences(list_of_dicts_lists):
-        # 鍒涘缓涓�涓瓧鍏告潵瀛樺偍姣忎釜閿殑鎬诲嚭鐜版鏁�
-        key_counts = {}
-        # 閬嶅巻鍒楄〃涓殑姣忎釜瀛楀吀鍒楄〃
-        for sublist in list_of_dicts_lists:
-            # 閬嶅巻褰撳墠瀛楀吀鍒楄〃涓殑姣忎釜瀛楀吀
-            for dict_item in sublist:
-                # 閬嶅巻瀛楀吀涓殑姣忎釜閿�
-                for key in dict_item:
-                    # 濡傛灉閿笉鍦╧ey_counts涓紝鍒欏垵濮嬪寲璁℃暟涓�0
-                    if key not in key_counts:
-                        key_counts[key] = 0
-                        # 澧炲姞褰撳墠閿殑璁℃暟
-                    key_counts[key] += 1
-                    # 鎵撳嵃缁撴灉
-        for key, count in key_counts.items():
-            if count > 1:
-                logger.info(f"'{key}' 杩炵画鍑虹幇 {count} 娆�")
-
-    # 璋冪敤鍑芥暟锛屼紶鍏ユ暣涓垪琛�
-    # count_key_occurrences(history_sorted_plate_ranking_list)
-
-    # daily_limit_up_info_list = list(reversed(daily_limit_up_info_list))
-    # print(f"daily_limit_up_info_list==={daily_limit_up_info_list}")
-
-    # 鑾峰彇鏄ㄦ棩娑ㄥ仠浠g爜 锛堜互渚夸笌K绾垮姣旓級
-    pre_trading_day_limit_up_info = data_cache.daily_limit_up_info.get(data_cache.DataCache().pre_trading_day)
-    if pre_trading_day_limit_up_info is not None:
-        yesterday_limit_up_code_list = []
-        for i in pre_trading_day_limit_up_info:
-            symbol_code = basic_methods.format_stock_symbol(i[0])
-            limit_up_code = symbol_code
-            yesterday_limit_up_code_list.append(limit_up_code)
-        data_cache.yesterday_limit_up_code_list = yesterday_limit_up_code_list
-        logger.info(f"鏄ㄦ棩娑ㄥ仠鑲$エ鏁伴噺=={len(data_cache.yesterday_limit_up_code_list)}")
-        logger.info(f"鏄ㄦ棩娑ㄥ仠浠g爜鍒楄〃=={yesterday_limit_up_code_list}")
-
-        # code = pre_trading_day_limit_up_info[0][0]
-        # logger.info(f"鑲$エ浠g爜=={code}")
-        # cor_name = pre_trading_day_limit_up_info[0][1]
-        # logger.info(f"鍏徃鍚嶇О=={cor_name}")
-        # unknown_zero_2 = pre_trading_day_limit_up_info[0][2]
-        # logger.info(f"鏈煡闆跺��2=={unknown_zero_2}")
-        # none_data = pre_trading_day_limit_up_info[0][3]
-        # logger.info(f"绌烘暟鎹�=={none_data}")
-        # # 鎬诲競鍊�(涓�)锛�
-        # total_market_value = round((pre_trading_day_limit_up_info[0][4] / 10000), 2)
-        # logger.info(f"鎬诲競鍊�=={total_market_value}(涓�)锛�")
-        # # 鏈�鐩稿叧姒傚康
-        # the_most_relevant_plate = pre_trading_day_limit_up_info[0][5]
-        # logger.info(f"鏈�鐩稿叧姒傚康=={the_most_relevant_plate}")
-        # # 鏀剁洏灏佸崟閲戦(涓�)
-        # closing_amount = round((pre_trading_day_limit_up_info[0][6] / 10000), 2)
-        # logger.info(f"鏀剁洏灏佸崟閲戦=={closing_amount}(涓�)")
-        # # 鏈�澶у皝鍗曢噾棰�(涓�)
-        # maximum_blocked_amount = round((pre_trading_day_limit_up_info[0][7] / 10000), 2)
-        # logger.info(f"鏈�澶у皝鍗曢噾棰�=={maximum_blocked_amount}(涓�)")
-        # # 涓诲姏鍑�棰�
-        # main_net_amount = round((pre_trading_day_limit_up_info[0][8] / 10000), 2)
-        # logger.info(f"涓诲姏鍑�棰�=={main_net_amount}(涓�)")
-        # # 涓诲姏涔�
-        # main_buyers = round((pre_trading_day_limit_up_info[0][9] / 10000), 2)
-        # logger.info(f"涓诲姏涔�=={main_buyers}(涓�)")
-        # # 涓诲姏鍗�
-        # main_sellers = round((pre_trading_day_limit_up_info[0][10] / 10000), 2)
-        # logger.info(f"涓诲姏鍗�=={main_sellers}(涓�)")
-        # # 鎴愪氦棰�
-        # transaction_amount = round((pre_trading_day_limit_up_info[0][11] / 10000), 2)
-        # logger.info(f"鎴愪氦棰�=={transaction_amount}(涓�)")
-        # # 鎵�灞炵簿閫夋澘鍧�
-        # selected_plate = pre_trading_day_limit_up_info[0][12]
-        # logger.info(f"鎵�灞炵簿閫夋澘鍧�=={selected_plate}")
-        # # 瀹為檯娴侀��
-        # actual_circulation = round((pre_trading_day_limit_up_info[0][11] / 100000000), 2)
-        # logger.info(f"瀹為檯娴侀��=={actual_circulation}(浜�)")
-        # # 閲忔瘮锛燂紙涓嶆槸锛屼笉鐭ラ亾鏄粈涔堬級
-        # equivalent_ratio = pre_trading_day_limit_up_info[0][14]
-        # logger.info(f"閲忔瘮锛�=={equivalent_ratio}")
-        # # 棰嗘定娆℃暟
-        # leading_increases_times = pre_trading_day_limit_up_info[0][15]
-        # logger.info(f"棰嗘定娆℃暟=={leading_increases_times}")
-        # # 鏈煡闆跺��
-        # unknown_zero_16 = pre_trading_day_limit_up_info[0][16]
-        # logger.info(f"鏈煡闆跺��16=={unknown_zero_16}")
-        # # 鏈煡闆跺��
-        # unknown_zero_17 = pre_trading_day_limit_up_info[0][17]
-        # logger.info(f"鏈煡闆跺��17=={unknown_zero_17}")
-        # # 绗嚑鏉�(杩炵画娑ㄥ仠澶╂暟)
-        # continuous_limit_up_days = pre_trading_day_limit_up_info[0][18]
-        # logger.info(f"绗嚑鏉�=={continuous_limit_up_days}")
-        # # 鏈�鐩稿叧姒傚康鐨勪唬鐮�
-        # the_most_relevant_plate_code = pre_trading_day_limit_up_info[0][19]
-        # logger.info(f"鏈�鐩稿叧姒傚康鐨勪唬鐮�=={the_most_relevant_plate_code}")
-        # # 鍚岀彮绾х殑鏁伴噺(鍚屾蹇垫定鍋滄暟閲�)
-        # the_same_class_amount = pre_trading_day_limit_up_info[0][20]
-        # logger.info(f"鍚屾蹇垫定鍋滄暟閲�=={the_same_class_amount}")
-
-
-# get_handling_limit_up_info()
-
-
-# 鑾峰彇鍏ㄩ儴涓偂鐨勬澘鍧楀苟瀛樺偍鐨勫嚱鏁�
-def get_all_stocks_plate_dict(stocks_list):
-    all_stocks_plate_dict = {}
-    # 閫愪釜鑾峰彇涓偂绮鹃�夋澘鍧楁蹇靛拰鑷敱甯傚�肩瓑锛屽苟鏁翠綋鏀惧叆涓�涓柊鍒涘缓鐨勫瓧鍏镐腑鐒跺悗娣诲姞鍒版暟鎹腑
-    for i in stocks_list:
-        try:
-            code = i.split('.')[1]
-            # print(f"i==={i}")
-            # 鑾峰彇涓偂鐨勮嚜鐢卞競鍊�
-            free_market_value = getZYLTAmount(code)
-            # 鑾峰彇涓偂鐨勬澘鍧楀垪琛�
-            selected_blocks = getStockIDPlate(code)
-            # 鎻愬彇绮鹃�夋澘鍧椾腑鐨勬澘鍧楀悕绉�
-            selected_plate_list = [block[1] for block in selected_blocks]
-            # print(f"selected_block_names==={selected_block_list}")
-            block_data = {
-                # 娣诲姞鑷敱甯傚��
-                'free_market_value': free_market_value,
-                # 娣诲姞绮鹃�夋澘鍧�
-                'plate': selected_plate_list
-            }
-            # 灏哻ode浣滀负閿紝stocks_selected_block_data浣滀负鍊兼坊鍔犲埌stocks_block_data瀛楀吀涓�
-            all_stocks_plate_dict[code] = block_data
-            # print(f"all_stocks_plate_dict==={all_stocks_plate_dict}")
-        except Exception as e:
-            print(f"鑾峰彇鍏ㄩ儴涓偂鐨勬澘鍧楀苟瀛樺偍鐨勫嚱鏁� An error occurred: {e}")
-        finally:
-            pass
-    # return stocks_plate_data
-    # print(f"all_stocks_plate_dict==={len(all_stocks_plate_dict)}")
-    # 灏嗚幏鍙栧埌鐨勮寖鍥寸エ姒傚康鏉垮潡杞琂SON鏍煎紡骞跺瓨鍌ㄥ湪鏈湴鏂囦欢澶逛腑
-    # 灏嗗瓧鍏歌浆鎹负JSON鏍煎紡鐨勫瓧绗︿覆
-    json_data = json.dumps(all_stocks_plate_dict)
-    # 鍐欏叆鏂囦欢
-    with open(constant.ALL_STOCKS_PLATE_PATH, 'w', encoding='utf-8') as f:
-        f.write(json_data)
-    now_time = datetime.datetime.now()  # 鑾峰彇鏈満鏃堕棿
-    logger.info(f"鍐欏叆鎵�鏈変釜鑲℃澘鍧楁枃浠跺畬鎴愶紒::{now_time}")
-
-
-# 璁$畻寮�鐩樺暒鏄ㄦ棩鎷夊彇鐨勬蹇垫暟鎹腑涓虹┖鐨勮偂绁ㄦ暟閲忓嚱鏁�
-def get_have_no_plate_num():
-    # 鍒濆鍖栨棤姒傚康鏁伴噺
-    have_no_plate_num = 0
-    plate_are_null_list = []
-    for k, v in data_cache.all_stocks_plate_dict.items():
-        pass
-        # print(f"i==={i}  T==={t}")
-        if len(v['plate']) == 0:
-            have_no_plate_num += 1
-            # print(f"{k}鐨勬蹇典负绌�")
-            # logger.info(f"{k}鐨勬蹇典负绌�")
-            # 鑲$エ浠g爜鏍煎紡杞寲涓烘帢閲戞牸寮�
-            symbol = basic_methods.format_stock_symbol(k)
-            sec_name = data_cache.all_stocks_all_K_line_property_dict.get(symbol)
-            if sec_name is not None:
-                plate_are_null_list.append(sec_name)
-    logger.info(f"鏈墈have_no_plate_num}鍙偂绁ㄦ蹇典负绌�")
-    logger.info(f"涓偂鏈夊巻鍙睰绾夸絾姒傚康涓虹┖鐨勬湁锛歿plate_are_null_list}")
-
-
-# 鑾峰彇鍏ㄩ儴涓偂鐨勭簿閫夋澘鍧楀苟瀛樺偍鐨勫嚱鏁�
-def stocks_list_selected_blocks(min_stocks):
-    stocks_selected_block_data = []
-    # 閫愪釜鑾峰彇涓偂绮鹃�夋澘鍧楁蹇靛拰鑷敱甯傚�肩瓑锛屽苟鏁翠綋鏀惧叆涓�涓柊鍒涘缓鐨勫瓧鍏镐腑鐒跺悗娣诲姞鍒版暟鎹腑
-    for i in min_stocks:
-        try:
-            code = i.split('.')[1]
-            # 鑾峰彇涓偂鐨勮嚜鐢卞競鍊�
-            free_market_value = getZYLTAmount(code)
-            # 鑾峰彇涓偂鐨勭簿閫夋澘鍧楀垪琛�
-            # selected_blocks = getCodeJingXuanBlocks('000021')
-            selected_blocks = getCodeJingXuanBlocks(code)
-            # 鎻愬彇绮鹃�夋澘鍧椾腑鐨勬澘鍧楀悕绉�
-            selected_block_list = [block[1] for block in selected_blocks]
-            # print(f"selected_block_names==={selected_block_list}")
-            stocks_selected_block_dict = {
-                # 娣诲姞鑲$エ浠g爜
-                'code': code,
-                # 娣诲姞鑷敱甯傚��
-                'free_market_value': free_market_value,
-                # 娣诲姞绮鹃�夋澘鍧�
-                'selected_block': selected_block_list
-            }
-            stocks_selected_block_data.append(stocks_selected_block_dict)
-            # print(f"stocks_selected_block_data==={stocks_selected_block_dict}")
-        except Exception as e:
-            logger.error(f"鑾峰彇鍏ㄩ儴涓偂鐨勭簿閫夋澘鍧楀苟瀛樺偍鐨勫嚱鏁� An error occurred: {e}")
-
-    # print(f"stocks_selected_block_data==={len(stocks_selected_block_data)}")
-    # 灏嗚幏鍙栧埌鐨勮寖鍥寸エ姒傚康鏉垮潡杞琂SON鏍煎紡骞跺瓨鍌ㄥ湪鏈湴鏂囦欢澶逛腑
-    # 灏嗗瓧鍏歌浆鎹负JSON鏍煎紡鐨勫瓧绗︿覆
-    json_data = json.dumps(stocks_selected_block_data)
-    # 鍐欏叆鏂囦欢
-    with open('local_storage_data/stocks_selected_block_data.json', 'w', encoding='utf-8') as f:
-        f.write(json_data)
-    now_time = datetime.datetime.now()  # 鑾峰彇鏈満鏃堕棿
-    print(f"鍐欏叆绮鹃�夋澘鍧楁枃浠跺畬鎴愶紒::{now_time}")
-
-
-# kpl_stocks_list_selected_blocks_process()   #鍦� kpl_api.py涓彲浠ヨ皟鐢�
-# stocks_list_selected_blocks(min_stocks)   #鍦� kpl_api.py涓彲浠ヨ皟鐢�
-# list = ['SHSE.600805','SHSE.600804']
 #
-# all_stocks_plate_dict(list)
-
+# # 鑾峰彇琛屾儏绮鹃�夋澘鍧� 寮哄害鎺掑悕
+# def get_market_sift_plate_its_stock_power():
+#     @dask.delayed
+#     def batch_get_plate_codes(fs):
+#         return fs
+#
+#     @dask.delayed
+#     def request_plate_codes(i):
+#         plate_name = i[1]
+#         log_data = None
+#         its_stock = json.loads(getCodesByPlate(i[0]))
+#         now_time_str = tool.get_now_time_str()
+#         if data_cache.OPENING_TIME < now_time_str < data_cache.NOON_MARKET_TIME:
+#             log_data = {plate_name: its_stock['list']}
+#         # 灏濊瘯杩囨护鎺夋棤鎰忎箟鐨勬蹇垫澘鍧�(plate_name not in ['绉戝垱鏉�', '鍖椾氦鎵�', '娆℃柊鑲�', '鏃�', 'ST鏉垮潡', 'ST鎽樺附', '骞惰喘閲嶇粍', '鍥戒紒鏀归潻','瓒呰穼', '澹宠祫婧�', '鑲℃潈杞', '閫佽浆濉潈']) and '澧為暱' in plate_name
+#         if (plate_name not in ['绉戝垱鏉�', '鍖椾氦鎵�', '娆℃柊鑲�', '鏃�', 'ST鏉垮潡', 'ST鎽樺附', '骞惰喘閲嶇粍', '鍥戒紒鏀归潻', '瓒呰穼',
+#                                '澹宠祫婧�', '鑲℃潈杞', '閫佽浆濉潈']) or ('澧為暱' in plate_name):
+#
+#             # print(f"{i[1]} 寮哄害:{i[2]}")
+#             # 閫氳繃鏉垮潡ID鑾峰彇鍏朵笅闈㈢殑涓偂寮哄害鍒楄〃
+#             # print(f"======={i[0]}=======")
+#
+#             # its_stock_list_info = its_stock['list']
+#             # logger.info(f"its_stock_list_info==={its_stock_list_info}")
+#             # 灏嗘澘鍧楀己搴︿笅闈㈠搴旂殑涓偂鍒楄〃鎵撳嵃鍒版棩蹇椾腑
+#             # for i in its_stock_list_info:
+#             #     if i[0] != 1:
+#             #         logger.info(
+#             #             f"l === 涓偂浠g爜锛歿i[0]}锛屽叕鍙稿悕绉帮細{i[1]}锛屼富鍔涜祫閲戞帹娴嬶細{i[2]}锛屾湭鐭�0鍊硷細{i[3]}锛屾蹇碉細{i[4]}锛屾渶鏂颁环锛歿i[5]}锛屽綋鏃ュ綋鏃舵定骞咃細{i[6]}%锛�"
+#             #             f"鎴愪氦棰濓細{round(i[7] / 100000000, 2)} 浜匡紝瀹為檯鎹㈡墜鐜囷細{i[8]}%锛屾湭鐭�0鍊硷細{i[9]}锛屽疄闄呮祦閫氾細{round(i[10] / 100000000, 2)}浜匡紝"
+#             #             f"涓诲姏涔帮細{round(i[11] / 100000000, 2)}浜匡紝"
+#             #             f"涓诲姏鍗栵細{round(i[12] / 100000000, 2)}浜匡紝"
+#             #             f"涓诲姏鍑�棰濓細{round(i[13] / 10000, 2)}涓囷紝涔版垚鍗犳瘮锛歿i[14]}%锛屽崠鎴愬崰姣旓細{i[15]}%锛屽噣鎴愬崰姣旓細{i[16]}%锛屼拱娴佸崰姣旓細{i[17]}%锛屽崠娴佸崰姣旓細{i[18]}%锛屽噣娴佸崰姣旓細{i[19]}%锛�"
+#             #             f"鍖洪棿娑ㄥ箙锛歿i[20]}%锛岄噺姣旓細{i[21]}锛屾湭鐭�0锛歿i[22]}锛屼笂鏉挎儏鍐碉細{i[23]}锛屼笂鏉挎帓鍚嶏細{i[24]}锛屾崲鎵嬬巼锛歿i[25]}%锛�"
+#             #             f"鏈煡绌哄�硷細{i[26]}锛屾湭鐭ラ浂鍊硷細{i[27]}锛屾敹鐩樺皝鍗曪細{i[28]}锛屾渶澶у皝鍗曪細{i[29]}锛屾湭鐭ョ┖鍊硷紵锛歿i[30]}锛�"
+#             #             f"锛燂細{i[30]}%锛岋紵锛歿i[31]}锛岋紵锛燂細{i[32]}锛屾尟骞咃細{i[33]}%锛屾湭鐭�0锛燂紵锛燂紵锛歿i[34]}锛屾湭鐭�0锛燂紵锛燂紵锛燂細{i[35]}锛�"
+#             #             f"锛�=锛歿i[36]}锛岋紵鎬诲競鍊硷細{i[37]}锛岋紵娴侀�氬競鍊硷細{i[38]}锛屾渶缁堝綊灞炴蹇碉紙鏀剁洏鍚庡嚭鏁版嵁锛燂級锛歿i[39]}锛岄娑ㄦ鏁帮細{i[40]}锛�"
+#             #             f"41鏈煡1鍊硷細{i[41]}锛岀涓夊搴︽満鏋勬寔浠撱�恠tr鏁版嵁鍕跨敤杩愮畻绗︺�戯細{i[42]}涓囷紝锛熷勾棰勬祴鍑�鍒╂鼎锛歿i[43]}锛屼笂骞撮娴嬪噣鍒╂鼎锛歿i[44]}锛屽勾鍐呴娴嬪噣鍒╂鼎锛歿i[45]}"
+#             #         )
+#
+#             # 鍒濆鍖栬偂绁ㄥ己搴﹀垪琛�
+#             stock_power_list = []
+#             for s in its_stock['list']:
+#                 # 杩囨护鎺夋定骞呭ぇ浜�  and s[6] < 6.5 涓斿皬浜�0%鐨� 鍜� 鍚嶇О涓寘鍚玈T鐨� 鍜� 娑ㄩ�熷皬浜庣瓑浜�0%鐨� 鍜� 鍙鏄ㄦ棩鏈定鍋� 鍜� 涓婅瘉鎴栨繁璇佺殑姝h偂    and s[9] > 0.0025
+#                 if s[6] > 0 and s[1].find("ST") < 0 and s[1].find("XD") < 0 and s[23].find("鏉�") < 0 and s[24].find("鏉�") < 0 and (s[0].startswith('60') or s[0].startswith('00')) and s[9] > 1:
+#                     # print(f"{s[1]}锛屼釜鑲′唬鐮侊細{s[0]}锛�   娑ㄥ箙锛歿s[6]}%   娑ㄩ�燂細{s[9]}%   姒傚康锛歿s[4]}   涓诲姏璧勯噾鎺ㄦ祴锛歿s[2]}   棰嗘定娆℃暟锛歿s[40]}  浠婃棩绗嚑鏉匡細{s[23]} 鏄惁鐮寸増{s[24]}")
+#                     # 瀵逛釜鑲″己搴� 涓昏 灞炴�у垪琛ㄨ繘琛岃濉�
+#                     its_stock_power = [s[1], s[0], s[6], s[9], s[4], s[2], s[40]]
+#                     # 閫愪釜閫夋嫨鎬ф坊鍔爄ts_stock涓殑鍏冪礌鍒颁釜鑲″己搴﹀垪琛ㄤ腑
+#                     # print(f"its_stock_power===={its_stock_power}")
+#                     # 鏁翠綋灏嗘坊鍔犲畬鍠勭殑涓偂寮哄害鍒楄〃娣诲姞鍒拌偂绁ㄥ垪琛ㄤ腑
+#                     stock_power_list.append(its_stock_power)
+#             # print(f"stock_power_list===={stock_power_list}")
+#             # 杩囨护鎺夋病鏈夌灛鏃堕珮寮哄害涓偂鐨勭┖姒傚康
+#             if len(stock_power_list) != 0:
+#                 # 灏嗗搴旀澘鍧楃殑鑲$エ寮哄害鍒楄〃鏂板缓涓�涓瓧鍏�
+#                 stock_power_item = {i[1]: stock_power_list}
+#                 # 骞舵洿鏂板埌绮鹃�夋澘鍧椾釜鑲″瓧鍏镐腑
+#                 market_sift_plate_stock_dict.update(stock_power_item)
+#         return log_data
+#
+#     data = (getMarketJingXuanRealRankingInfo())
+#     market_sift_plate = json.loads(data)
+#     # logger_kpl_jingxuan_in 鎵撳嵃鐨勬棩蹇椾笓鐢ㄤ簬寮�鐩樹簡鏁版嵁鐨勫瓨鍌ㄥ垎鏋愶紝涓嶈兘杞绘槗鍒犻櫎
+#     # print(f"market_sift_plate 鏁� ======{len(market_sift_plate['list'])}")
+#     # 琛屾儏銆嬬簿閫夋澘鍧椼�嬫帓鍚嶅墠20涓�嬪搴斾釜鑲°�嬬鍚堟潯浠剁殑涓偂
+#     # logger.info(f"market_sift_plate['list']======{market_sift_plate['list']}")
+#     # logger.info(f"market_sift_plate['list'][0]  ======{market_sift_plate['list'][0]}")
+#     # 鍒濆鍖栫簿閫夋澘鍧楀搴斾釜鑲″瓧鍏�
+#     market_sift_plate_stock_dict = {}
+#     if 'list' in market_sift_plate:
+#         ds = []
+#         for d in market_sift_plate['list']:
+#             ds.append(request_plate_codes(d))
+#         dask_result = batch_get_plate_codes(ds)
+#         compute_results = dask_result.compute()
+#         log_datas = {}
+#         for r in compute_results:
+#             if not r:
+#                 continue
+#             for b in r:
+#                 log_datas[b] = r[b]
+#         now_time = tool.get_now_time_str()
+#         if data_cache.L1_DATA_START_TIME < now_time < data_cache.NOON_MARKET_TIME:
+#             # logger.info(f"绮鹃�夋澘鍧楄偂绁ㄥ己搴︽暟鎹洿鏂� == {market_sift_plate_stock_dict}")
+#             # 鍙湪鐩樹腑鏃堕棿鑾峰彇
+#             KPLStockOfMarketsPlateLogManager().add_log(market_sift_plate['list'], log_datas)
+#
+#     return market_sift_plate_stock_dict
+#
+#
+# # 璋冪敤涓�涓嬭幏鍙栫簿閫夋澘鍧楄偂绁ㄥ己搴︽暟鎹嚱鏁�  銆愭湰妯″潡鍐呬娇鐢ㄦ椂璋冪敤銆�
+# # get_market_sift_plate_its_stock_power()
+#
+# def get_market_sift_plate_its_stock_power_process(callback):
+#     while True:
+#         try:
+#             # now = time.time()
+#             # print(f"kpl_limit_up_process寮�濮嬩簡{now}")
+#             start_time = time.time()
+#             now_time = tool.get_now_time_str()
+#             if data_cache.L1_DATA_START_TIME < now_time < data_cache.CLOSING_TIME:
+#                 its_stock_power = get_market_sift_plate_its_stock_power()
+#                 time_str = datetime.datetime.now().strftime("%H%M%S")
+#                 if 92900 < int(time_str) < 95000:
+#                     logger_kpl_jingxuan_in.info(f"鑰楁椂锛歿time.time() - start_time}  鏁版嵁锛歿its_stock_power}")
+#                 callback(its_stock_power)
+#                 # print(f"绮鹃�夋澘鍧楁媺鍗囦釜鑲℃洿鏂�===={its_stock_power}")
+#         except Exception as e:
+#             logger_debug.exception(e)
+#             logger.error(f"寮�鐩樺暒鏉垮潡寮哄害绾跨▼鎶ラ敊An error occurred: {e}")
+#         finally:
+#             time.sleep(2)
+#
+#
+# # 鑾峰彇娑ㄥ仠鏉垮潡鍚嶇О鍒楄〃骞跺瓨鍌ㄦ湰鍦扮殑鍑芥暟
+# def get_limit_up_block_names():
+#     # 璁惧畾褰撳墠鏃堕棿鐐�
+#     now_time = tool.get_now_time_str()
+#     # print(f"now_time===={now_time}")
+#     if data_cache.SERVER_RESTART_TIME < now_time < data_cache.UPDATE_DATA_TIME:
+#         # print(f"鍦ㄦ椂闂村唴浣跨敤--------------------------")
+#         # 鑾峰彇娑ㄥ仠淇℃伅鍒楄〃
+#         limit_up_info = get_limit_up_info()
+#         # print(f"limit_up_info=={limit_up_info}")
+#         data_cache.limit_up_info = get_limit_up_info()
+#         # 鎻愬彇娑ㄥ仠鍒楄〃涓殑鏉垮潡鍚嶇О
+#         limit_up_block_names = []
+#         # 寰幆娣诲姞娑ㄥ仠姒傚康
+#         for i in limit_up_info:
+#             limit_up_block_names.append(i[5])
+#         # print(f"limit_up_block_names==={limit_up_block_names}")
+#         # return limit_up_block_names
+#         # # 浣跨敤Counter璁$畻姣忎釜鍏冪礌鐨勫嚭鐜版鏁�
+#         # counter = Counter(limit_up_block_names)
+#         # # 鎵惧嚭鍑虹幇娆℃暟鏈�澶氱殑鍏冪礌鍙婂叾娆℃暟
+#         # most_common_element, most_common_count = counter.most_common(1)[0]
+#         # # 鎵撳嵃鍑虹幇娆℃暟鏈�澶氱殑鍏冪礌
+#         # print(f"涓荤嚎姒傚康锛歿most_common_element}锛屽嚭鐜颁簡 {most_common_count} 娆�")
+#
+#         return limit_up_block_names
+#
+#
+# # 涓哄紑鐩樺暒鎺ュ彛鑾峰彇鐨勬定鍋滃垪琛ㄦ蹇垫澘鍧楀崟鐙紑涓�涓繘绋�  褰㈠弬(callback)
+# def kpl_limit_up_process(callback):
+#     while True:
+#         try:
+#             # now = time.time()
+#             # print(f"kpl_limit_up_process寮�濮嬩簡{now}")
+#             limit_up_block_names = get_limit_up_block_names()
+#             callback(limit_up_block_names)
+#             # logger.info(f"娑ㄥ仠鏇存柊===={limit_up_block_names}")
+#             # print(f"娑ㄥ仠鏇存柊鏁伴噺===={len(limit_up_block_names)}")
+#             # print(f"kpl_limit_up_process瀹屾垚涓�涓媨now}")
+#         except Exception as e:
+#             logger.error(f"寮�鐩樺暒娑ㄥ仠鏉垮潡姒傚康绾跨▼鎶ラ敊An error occurred: {e}")
+#         finally:
+#             time.sleep(1.5)
+#
+#
+# # kpl_limit_up_process()
+#
+#
+# # 鏋勫缓娑ㄥ仠淇℃伅璇诲啓瀵硅薄
+# class DailyLimitUpInfoStorageManager:
+#     # 鍒濆鍖栨枃浠惰矾寰�
+#     def __init__(self, file_path=constant.KPL_LIMIT_UP_DATA_PATH):
+#         self.file_path = file_path
+#
+#     # 娣诲姞鍗曟棩娑ㄥ仠淇℃伅鏁版嵁鍒版枃浠朵腑鐨勪竴琛� 鍑芥暟
+#     def append_data_to_file(self, data_to_append):
+#         # print(f"data_to_append=={data_to_append}")
+#         # 璇诲彇鎵�鏈夎骞惰В鏋愪负 JSON 瀵硅薄鍒楄〃
+#         if os.path.exists(self.file_path):
+#             with open(self.file_path, 'r', encoding='utf-8') as file:
+#                 # 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲
+#                 current_date = datetime.datetime.now().strftime('%Y-%m-%d')
+#                 lines = [json.loads(line.strip()) for line in file if line.strip()]
+#                 # print(f"lines type=={type(lines)}")
+#                 # print(f"lines=={lines}")
+#                 # 妫�鏌ュ綋鍓嶆棩鏈熸槸鍚﹀凡瀛樺湪浜庢枃浠朵腑
+#                 if lines:  # 濡傛灉璇诲彇鍒扮殑琛屾枃浠跺垪琛ㄤ笉涓虹┖锛堜负鐪燂級
+#                     if lines[-1].get(current_date) is None:  # 濡傛灉鍒楄〃涓殑鍊掓暟鏈�鍚庝竴琛岃幏鍙栦笉鍒板綋鏃ョ殑鏃ユ湡锛堟渶鍚庝竴琛岀殑閿� 涓� 褰撴棩鏃ユ湡锛�
+#                         # 灏嗘棩鏈熷拰data_to_append杞崲涓篔SON鏍煎紡鐨勫瓧绗︿覆
+#                         json_line = json.dumps({current_date: data_to_append}, ensure_ascii=False) + '\n'
+#                         # 鎵撳紑鏂囦欢骞惰拷鍔燡SON琛�
+#                         with open(self.file_path, 'a', encoding='utf-8') as file:
+#                             file.write(json_line)
+#                     else:
+#                         logger.info(f"锛堝綋鏃ユ棩鏈熷凡瀛樺湪浜庢枃浠剁殑鏈�鍚庝竴琛屼簡锛屼笉鍐嶉噸澶嶈拷鍔犲啓鍏ワ級")
+#                 else:
+#                     json_line = json.dumps({current_date: data_to_append}, ensure_ascii=False) + '\n'
+#                     # 鎵撳紑鏂囦欢骞惰拷鍔燡SON琛�
+#                     with open(self.file_path, 'a', encoding='utf-8') as file:
+#                         file.write(json_line)
+#
+#     # 娓呯悊澶氫綑鏁版嵁鍑芥暟
+#     def check_and_remove_oldest_entry(self, max_entries):
+#         # 璇诲彇鎵�鏈夎骞惰В鏋愪负 JSON 瀵硅薄鍒楄〃
+#         if os.path.exists(self.file_path):
+#             with open(self.file_path, 'r', encoding='utf-8') as file:
+#                 lines = [json.loads(line.strip()) for line in file if line.strip()]
+#         else:
+#             lines = []
+#
+#             # 濡傛灉琛屾暟瓒呰繃闄愬埗锛岀Щ闄ゆ渶鏃╃殑涓�浜涜
+#         if len(lines) >= max_entries:
+#             # 鎴柇鍒楄〃锛屽彧淇濈暀鏈�鏂扮殑 max_entries 涓璞�
+#             lines = lines[-max_entries:]
+#             # 閲嶆柊鎵撳紑鏂囦欢浠ュ啓鍏ユā寮忥紝骞跺啓鍏ユ埅鏂悗鐨勫璞″垪琛ㄤ负 JSON Lines
+#             with open(self.file_path, 'w', encoding='utf-8') as file:
+#                 for obj in lines:
+#                     file.write(json.dumps(obj, ensure_ascii=False) + '\n')
+#                     # file.write(json.dumps(obj, ensure_ascii=False))
+#
+#     # 闅旇鏁寸悊鏁版嵁骞跺悎骞惰鍏ヤ竴涓瓧鍏告暟鎹腑璋冪敤鏃惰繑鍥炶繖涓瓧鍏告暟鎹� 鍑芥暟
+#     def arrange_limit_up_info(self):
+#         limit_info = {}
+#         # 鍒涘缓涓�涓垪琛ㄦ潵瀛樺偍鎵�鏈夎В鏋愮殑 JSON 瀵硅薄
+#         if os.path.exists(self.file_path):
+#             with open(self.file_path, 'r', encoding='utf-8') as file:
+#                 for line in file:
+#                     # 鍘婚櫎姣忚鏈熬鐨勬崲琛岀锛堝鏋滄湁鐨勮瘽锛�
+#                     line = line.rstrip('\n')
+#                     # 灏嗘瘡琛岃В鏋愪负涓�涓� JSON 瀵硅薄
+#                     info = json.loads(line)
+#                     # 鍋囪姣忚閮芥槸涓�涓瓧鍏告暟鎹紝涓斿彧鏈変竴涓敭鍊煎锛屽叾涓敭鏄棩鏈�
+#                     if isinstance(info, dict) and len(info) == 1:
+#                         date, data = list(info.items())[0]
+#                         limit_info[date] = data
+#         return limit_info
+#
+#
+# # 鏋勫缓涓�涓幏鍙栬鍐欏瓨鍌ㄦ湰鍦扮殑骞舵暣鐞嗘定鍋滄暟鎹殑鍑芥暟
+# def get_arrange_limit_up_info():
+#     # 瀹炰緥鍖栨瘡鏃ユ定鍋滀俊鎭暣鐞嗘柟娉�
+#     manager = DailyLimitUpInfoStorageManager()
+#     manager.append_data_to_file(get_limit_up_info())
+#     manager.check_and_remove_oldest_entry(max_entries=1000)
+#
+#
+# # 鏋勫缓涓�涓鐞嗗巻鍙叉定鍋滄定鍋滀俊鎭暟鎹殑鍑芥暟
+# def get_handling_limit_up_info():
+#     # 瀹炰緥鍖栨瘡鏃ユ定鍋滀俊鎭暣鐞嗘柟娉�
+#     history_limit_up_info = DailyLimitUpInfoStorageManager()
+#     data_cache.daily_limit_up_info = history_limit_up_info.arrange_limit_up_info()
+#     # logger.info(f"璇绘湰鍦扮殑鏃ユ洿鐨勫巻鍙叉定鍋滄暟鎹�=={data_cache.daily_limit_up_info}")
+#
+#     # print(f"daily_limit_up_info  绫诲瀷==={type(data_cache.daily_limit_up_info)}")
+#     # 缁熻姣忔棩涓荤嚎
+#     daily_limit_up_info_len = len(data_cache.daily_limit_up_info)
+#     # print(f"daily_limit_up_info_len==={daily_limit_up_info_len}")
+#
+#     historical_transaction_date_list = []
+#     date_of_the_day = data_cache.DataCache().today_date
+#     for i in range(daily_limit_up_info_len):
+#         pre_date = hx_qc_value_util.get_previous_trading_date(date_of_the_day)  # 鑾峰彇鍓嶄竴涓氦鏄撴棩API
+#         # target_date_str = basic_methods.pre_num_trading_day(data_cache.today_date, daily_limit_up_info_len)
+#         date_format = "%Y-%m-%d"
+#         target_date = datetime.datetime.strptime(pre_date, date_format).strftime("%Y-%m-%d")
+#         historical_transaction_date_list.append(target_date)
+#         date_of_the_day = pre_date
+#
+#     # print(f"historical_transaction_date_list={historical_transaction_date_list}")
+#     history_sorted_plate_ranking_list = []
+#     for key, value in data_cache.daily_limit_up_info.items():
+#         # print(f"key=={key}")
+#         for i in historical_transaction_date_list:
+#             # print(f"i======={i}")
+#             # 鎵惧埌姣忎笂涓�涓氦鏄撴棩瀵瑰簲鐨勬湰鍦版暟鎹殑淇℃伅
+#             if key == i:
+#                 # print(f"{key}===鎵惧埌浜嗭紒value={value}")
+#                 #
+#                 plate_ranking_list = []
+#                 # 閬嶅巻浜ゆ槗鏃ユ瘡涓�涓定鍋滆偂鐨勪俊鎭�
+#                 for v in value:
+#                     # print(f"v =={v}")
+#                     # 灏嗘瘡涓�涓定鍋滆偂鐨勬定鍋滄蹇靛拰鍚岀彮绾ф暟閲� 姹囩紪涓轰竴涓瓧鍏�
+#                     plate_limit_up_num_dict = {
+#                         v[5]: v[20]
+#                     }
+#                     # 灏嗚繖涓瓧鍏告暟鎹笉閲嶅鐨勬坊鍔犲埌姒傚康鎺掑悕鍒楄〃涓�
+#                     if plate_limit_up_num_dict not in plate_ranking_list:
+#                         plate_ranking_list.append(plate_limit_up_num_dict)
+#                         # plate_ranking_set.add(v[20])
+#                 # print(f"plate_ranking_list={plate_ranking_list}")
+#                 # 浣跨敤sorted鍑芥暟鍜宭ambda琛ㄨ揪寮忔潵鏍规嵁瀛楀吀鐨勫�艰繘琛屾帓搴�
+#                 # 杩欓噷鎴戜滑纭繚涓嶄慨鏀瑰師濮嬪瓧鍏革紝浠呴�氳繃list(x.values())[0]鏉ヨ幏鍙栧��
+#                 sorted_plate_ranking_list = sorted(plate_ranking_list, key=lambda x: list(x.values())[0], reverse=True)
+#                 # logger.info(f"{key}=====>>>>{sorted_plate_ranking_list}")
+#                 history_sorted_plate_ranking_list.append(sorted_plate_ranking_list)
+#
+#     # print(f"history_sorted_plate_ranking_list={history_sorted_plate_ranking_list}")
+#     # for ranking_list in history_sorted_plate_ranking_list:
+#     #     print(f"ranking_list={ranking_list}")
+#     #     for i in ranking_list:
+#     #         print(f"i={i}")
+#
+#     # 璁$畻鍘嗗彶娑ㄥ仠姒傚康鐨勮繛缁嚭鐜版鏁板嚱鏁�
+#     def count_key_occurrences(list_of_dicts_lists):
+#         # 鍒涘缓涓�涓瓧鍏告潵瀛樺偍姣忎釜閿殑鎬诲嚭鐜版鏁�
+#         key_counts = {}
+#         # 閬嶅巻鍒楄〃涓殑姣忎釜瀛楀吀鍒楄〃
+#         for sublist in list_of_dicts_lists:
+#             # 閬嶅巻褰撳墠瀛楀吀鍒楄〃涓殑姣忎釜瀛楀吀
+#             for dict_item in sublist:
+#                 # 閬嶅巻瀛楀吀涓殑姣忎釜閿�
+#                 for key in dict_item:
+#                     # 濡傛灉閿笉鍦╧ey_counts涓紝鍒欏垵濮嬪寲璁℃暟涓�0
+#                     if key not in key_counts:
+#                         key_counts[key] = 0
+#                         # 澧炲姞褰撳墠閿殑璁℃暟
+#                     key_counts[key] += 1
+#                     # 鎵撳嵃缁撴灉
+#         for key, count in key_counts.items():
+#             if count > 1:
+#                 logger.info(f"'{key}' 杩炵画鍑虹幇 {count} 娆�")
+#
+#     # 璋冪敤鍑芥暟锛屼紶鍏ユ暣涓垪琛�
+#     # count_key_occurrences(history_sorted_plate_ranking_list)
+#
+#     # daily_limit_up_info_list = list(reversed(daily_limit_up_info_list))
+#     # print(f"daily_limit_up_info_list==={daily_limit_up_info_list}")
+#
+#     # 鑾峰彇鏄ㄦ棩娑ㄥ仠浠g爜 锛堜互渚夸笌K绾垮姣旓級
+#     pre_trading_day_limit_up_info = data_cache.daily_limit_up_info.get(data_cache.DataCache().pre_trading_day)
+#     if pre_trading_day_limit_up_info is not None:
+#         yesterday_limit_up_code_list = []
+#         for i in pre_trading_day_limit_up_info:
+#             symbol_code = basic_methods.format_stock_symbol(i[0])
+#             limit_up_code = symbol_code
+#             yesterday_limit_up_code_list.append(limit_up_code)
+#         data_cache.yesterday_limit_up_code_list = yesterday_limit_up_code_list
+#         logger.info(f"鏄ㄦ棩娑ㄥ仠鑲$エ鏁伴噺=={len(data_cache.yesterday_limit_up_code_list)}")
+#         logger.info(f"鏄ㄦ棩娑ㄥ仠浠g爜鍒楄〃=={yesterday_limit_up_code_list}")
+#
+#         # code = pre_trading_day_limit_up_info[0][0]
+#         # logger.info(f"鑲$エ浠g爜=={code}")
+#         # cor_name = pre_trading_day_limit_up_info[0][1]
+#         # logger.info(f"鍏徃鍚嶇О=={cor_name}")
+#         # unknown_zero_2 = pre_trading_day_limit_up_info[0][2]
+#         # logger.info(f"鏈煡闆跺��2=={unknown_zero_2}")
+#         # none_data = pre_trading_day_limit_up_info[0][3]
+#         # logger.info(f"绌烘暟鎹�=={none_data}")
+#         # # 鎬诲競鍊�(涓�)锛�
+#         # total_market_value = round((pre_trading_day_limit_up_info[0][4] / 10000), 2)
+#         # logger.info(f"鎬诲競鍊�=={total_market_value}(涓�)锛�")
+#         # # 鏈�鐩稿叧姒傚康
+#         # the_most_relevant_plate = pre_trading_day_limit_up_info[0][5]
+#         # logger.info(f"鏈�鐩稿叧姒傚康=={the_most_relevant_plate}")
+#         # # 鏀剁洏灏佸崟閲戦(涓�)
+#         # closing_amount = round((pre_trading_day_limit_up_info[0][6] / 10000), 2)
+#         # logger.info(f"鏀剁洏灏佸崟閲戦=={closing_amount}(涓�)")
+#         # # 鏈�澶у皝鍗曢噾棰�(涓�)
+#         # maximum_blocked_amount = round((pre_trading_day_limit_up_info[0][7] / 10000), 2)
+#         # logger.info(f"鏈�澶у皝鍗曢噾棰�=={maximum_blocked_amount}(涓�)")
+#         # # 涓诲姏鍑�棰�
+#         # main_net_amount = round((pre_trading_day_limit_up_info[0][8] / 10000), 2)
+#         # logger.info(f"涓诲姏鍑�棰�=={main_net_amount}(涓�)")
+#         # # 涓诲姏涔�
+#         # main_buyers = round((pre_trading_day_limit_up_info[0][9] / 10000), 2)
+#         # logger.info(f"涓诲姏涔�=={main_buyers}(涓�)")
+#         # # 涓诲姏鍗�
+#         # main_sellers = round((pre_trading_day_limit_up_info[0][10] / 10000), 2)
+#         # logger.info(f"涓诲姏鍗�=={main_sellers}(涓�)")
+#         # # 鎴愪氦棰�
+#         # transaction_amount = round((pre_trading_day_limit_up_info[0][11] / 10000), 2)
+#         # logger.info(f"鎴愪氦棰�=={transaction_amount}(涓�)")
+#         # # 鎵�灞炵簿閫夋澘鍧�
+#         # selected_plate = pre_trading_day_limit_up_info[0][12]
+#         # logger.info(f"鎵�灞炵簿閫夋澘鍧�=={selected_plate}")
+#         # # 瀹為檯娴侀��
+#         # actual_circulation = round((pre_trading_day_limit_up_info[0][11] / 100000000), 2)
+#         # logger.info(f"瀹為檯娴侀��=={actual_circulation}(浜�)")
+#         # # 閲忔瘮锛燂紙涓嶆槸锛屼笉鐭ラ亾鏄粈涔堬級
+#         # equivalent_ratio = pre_trading_day_limit_up_info[0][14]
+#         # logger.info(f"閲忔瘮锛�=={equivalent_ratio}")
+#         # # 棰嗘定娆℃暟
+#         # leading_increases_times = pre_trading_day_limit_up_info[0][15]
+#         # logger.info(f"棰嗘定娆℃暟=={leading_increases_times}")
+#         # # 鏈煡闆跺��
+#         # unknown_zero_16 = pre_trading_day_limit_up_info[0][16]
+#         # logger.info(f"鏈煡闆跺��16=={unknown_zero_16}")
+#         # # 鏈煡闆跺��
+#         # unknown_zero_17 = pre_trading_day_limit_up_info[0][17]
+#         # logger.info(f"鏈煡闆跺��17=={unknown_zero_17}")
+#         # # 绗嚑鏉�(杩炵画娑ㄥ仠澶╂暟)
+#         # continuous_limit_up_days = pre_trading_day_limit_up_info[0][18]
+#         # logger.info(f"绗嚑鏉�=={continuous_limit_up_days}")
+#         # # 鏈�鐩稿叧姒傚康鐨勪唬鐮�
+#         # the_most_relevant_plate_code = pre_trading_day_limit_up_info[0][19]
+#         # logger.info(f"鏈�鐩稿叧姒傚康鐨勪唬鐮�=={the_most_relevant_plate_code}")
+#         # # 鍚岀彮绾х殑鏁伴噺(鍚屾蹇垫定鍋滄暟閲�)
+#         # the_same_class_amount = pre_trading_day_limit_up_info[0][20]
+#         # logger.info(f"鍚屾蹇垫定鍋滄暟閲�=={the_same_class_amount}")
+#
+#
+# # get_handling_limit_up_info()
+#
+#
+# # 鑾峰彇鍏ㄩ儴涓偂鐨勬澘鍧楀苟瀛樺偍鐨勫嚱鏁�
+# def get_all_stocks_plate_dict(stocks_list):
+#     all_stocks_plate_dict = {}
+#     # 閫愪釜鑾峰彇涓偂绮鹃�夋澘鍧楁蹇靛拰鑷敱甯傚�肩瓑锛屽苟鏁翠綋鏀惧叆涓�涓柊鍒涘缓鐨勫瓧鍏镐腑鐒跺悗娣诲姞鍒版暟鎹腑
+#     for i in stocks_list:
+#         try:
+#             code = i.split('.')[1]
+#             # print(f"i==={i}")
+#             # 鑾峰彇涓偂鐨勮嚜鐢卞競鍊�
+#             free_market_value = getZYLTAmount(code)
+#             # 鑾峰彇涓偂鐨勬澘鍧楀垪琛�
+#             selected_blocks = getStockIDPlate(code)
+#             # 鎻愬彇绮鹃�夋澘鍧椾腑鐨勬澘鍧楀悕绉�
+#             selected_plate_list = [block[1] for block in selected_blocks]
+#             # print(f"selected_block_names==={selected_block_list}")
+#             block_data = {
+#                 # 娣诲姞鑷敱甯傚��
+#                 'free_market_value': free_market_value,
+#                 # 娣诲姞绮鹃�夋澘鍧�
+#                 'plate': selected_plate_list
+#             }
+#             # 灏哻ode浣滀负閿紝stocks_selected_block_data浣滀负鍊兼坊鍔犲埌stocks_block_data瀛楀吀涓�
+#             all_stocks_plate_dict[code] = block_data
+#             # print(f"all_stocks_plate_dict==={all_stocks_plate_dict}")
+#         except Exception as e:
+#             print(f"鑾峰彇鍏ㄩ儴涓偂鐨勬澘鍧楀苟瀛樺偍鐨勫嚱鏁� An error occurred: {e}")
+#         finally:
+#             pass
+#     # return stocks_plate_data
+#     # print(f"all_stocks_plate_dict==={len(all_stocks_plate_dict)}")
+#     # 灏嗚幏鍙栧埌鐨勮寖鍥寸エ姒傚康鏉垮潡杞琂SON鏍煎紡骞跺瓨鍌ㄥ湪鏈湴鏂囦欢澶逛腑
+#     # 灏嗗瓧鍏歌浆鎹负JSON鏍煎紡鐨勫瓧绗︿覆
+#     json_data = json.dumps(all_stocks_plate_dict)
+#     # 鍐欏叆鏂囦欢
+#     with open(constant.ALL_STOCKS_PLATE_PATH, 'w', encoding='utf-8') as f:
+#         f.write(json_data)
+#     now_time = datetime.datetime.now()  # 鑾峰彇鏈満鏃堕棿
+#     logger.info(f"鍐欏叆鎵�鏈変釜鑲℃澘鍧楁枃浠跺畬鎴愶紒::{now_time}")
+#
+#
+# # 璁$畻寮�鐩樺暒鏄ㄦ棩鎷夊彇鐨勬蹇垫暟鎹腑涓虹┖鐨勮偂绁ㄦ暟閲忓嚱鏁�
+# def get_have_no_plate_num():
+#     # 鍒濆鍖栨棤姒傚康鏁伴噺
+#     have_no_plate_num = 0
+#     plate_are_null_list = []
+#     for k, v in data_cache.all_stocks_plate_dict.items():
+#         pass
+#         # print(f"i==={i}  T==={t}")
+#         if len(v['plate']) == 0:
+#             have_no_plate_num += 1
+#             # print(f"{k}鐨勬蹇典负绌�")
+#             # logger.info(f"{k}鐨勬蹇典负绌�")
+#             # 鑲$エ浠g爜鏍煎紡杞寲涓烘帢閲戞牸寮�
+#             symbol = basic_methods.format_stock_symbol(k)
+#             sec_name = data_cache.all_stocks_all_K_line_property_dict.get(symbol)
+#             if sec_name is not None:
+#                 plate_are_null_list.append(sec_name)
+#     logger.info(f"鏈墈have_no_plate_num}鍙偂绁ㄦ蹇典负绌�")
+#     logger.info(f"涓偂鏈夊巻鍙睰绾夸絾姒傚康涓虹┖鐨勬湁锛歿plate_are_null_list}")
+#
+#
+# # 鑾峰彇鍏ㄩ儴涓偂鐨勭簿閫夋澘鍧楀苟瀛樺偍鐨勫嚱鏁�
+# def stocks_list_selected_blocks(min_stocks):
+#     stocks_selected_block_data = []
+#     # 閫愪釜鑾峰彇涓偂绮鹃�夋澘鍧楁蹇靛拰鑷敱甯傚�肩瓑锛屽苟鏁翠綋鏀惧叆涓�涓柊鍒涘缓鐨勫瓧鍏镐腑鐒跺悗娣诲姞鍒版暟鎹腑
+#     for i in min_stocks:
+#         try:
+#             code = i.split('.')[1]
+#             # 鑾峰彇涓偂鐨勮嚜鐢卞競鍊�
+#             free_market_value = getZYLTAmount(code)
+#             # 鑾峰彇涓偂鐨勭簿閫夋澘鍧楀垪琛�
+#             # selected_blocks = getCodeJingXuanBlocks('000021')
+#             selected_blocks = getCodeJingXuanBlocks(code)
+#             # 鎻愬彇绮鹃�夋澘鍧椾腑鐨勬澘鍧楀悕绉�
+#             selected_block_list = [block[1] for block in selected_blocks]
+#             # print(f"selected_block_names==={selected_block_list}")
+#             stocks_selected_block_dict = {
+#                 # 娣诲姞鑲$エ浠g爜
+#                 'code': code,
+#                 # 娣诲姞鑷敱甯傚��
+#                 'free_market_value': free_market_value,
+#                 # 娣诲姞绮鹃�夋澘鍧�
+#                 'selected_block': selected_block_list
+#             }
+#             stocks_selected_block_data.append(stocks_selected_block_dict)
+#             # print(f"stocks_selected_block_data==={stocks_selected_block_dict}")
+#         except Exception as e:
+#             logger.error(f"鑾峰彇鍏ㄩ儴涓偂鐨勭簿閫夋澘鍧楀苟瀛樺偍鐨勫嚱鏁� An error occurred: {e}")
+#
+#     # print(f"stocks_selected_block_data==={len(stocks_selected_block_data)}")
+#     # 灏嗚幏鍙栧埌鐨勮寖鍥寸エ姒傚康鏉垮潡杞琂SON鏍煎紡骞跺瓨鍌ㄥ湪鏈湴鏂囦欢澶逛腑
+#     # 灏嗗瓧鍏歌浆鎹负JSON鏍煎紡鐨勫瓧绗︿覆
+#     json_data = json.dumps(stocks_selected_block_data)
+#     # 鍐欏叆鏂囦欢
+#     with open('local_storage_data/stocks_selected_block_data.json', 'w', encoding='utf-8') as f:
+#         f.write(json_data)
+#     now_time = datetime.datetime.now()  # 鑾峰彇鏈満鏃堕棿
+#     print(f"鍐欏叆绮鹃�夋澘鍧楁枃浠跺畬鎴愶紒::{now_time}")
+#
+#
+# # kpl_stocks_list_selected_blocks_process()   #鍦� kpl_api.py涓彲浠ヨ皟鐢�
+# # stocks_list_selected_blocks(min_stocks)   #鍦� kpl_api.py涓彲浠ヨ皟鐢�
+# # list = ['SHSE.600805','SHSE.600804']
+# #
+# # all_stocks_plate_dict(list)
+#

--
Gitblit v1.8.0