From 967abfe26abe09c26df61fe48bab1d64e2253cef Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 20 十一月 2024 15:26:37 +0800 Subject: [PATCH] 添加新接口 --- third_data/code_plate_key_manager.py | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/third_data/code_plate_key_manager.py b/third_data/code_plate_key_manager.py index 6869055..ae2243a 100644 --- a/third_data/code_plate_key_manager.py +++ b/third_data/code_plate_key_manager.py @@ -330,8 +330,10 @@ # 瀹炴椂寮�鐩樺暒甯傚満鏁版嵁 class RealTimeKplMarketData: - # 绮鹃�夊墠5 - top_5_reason_list = [] + # 娴佸叆缂撳瓨 + top_in_list_cache = [] + # 娴佸嚭缂撳瓨 + top_out_list_cache = [] # 琛屼笟鍓�5 top_5_industry_list = [] # @@ -342,9 +344,11 @@ __LimitUpCodesPlateKeyManager = LimitUpCodesPlateKeyManager() __KPLPlatManager = KPLPlatManager() # 绮鹃�夋祦鍏ュ墠鍑� - __top_jx_blocks = set() + __top_jx_blocks = [] # 绮鹃�夋祦鍑哄墠鍑� - __top_jx_out_blocks = set() + __top_jx_out_blocks = [] + # 绮鹃�夋澘鍧楁祦鍏ラ噾棰� + __jx_blocks_in_money_dict = {} @classmethod def set_market_jingxuan_blocks(cls, datas): @@ -360,9 +364,12 @@ # break # blocks.add(data[1]) # cls.__top_jx_blocks = blocks + cls.top_in_list_cache = datas blocks = set() count = 0 + fblock_money = {} for data in datas: + cls.__jx_blocks_in_money_dict[data[1]] = data[3] if data[1] in constant.KPL_INVALID_BLOCKS: continue if data[3] < 5e7: @@ -371,12 +378,16 @@ fb = BlockMapManager().filter_blocks({data[1]}) if blocks & fb: continue + for b in fb: + fblock_money[b] = data[3] blocks |= fb count += 1 if count >= 10: break # 璁板綍绮鹃�夋祦鍑烘棩蹇� async_log_util.info(logger_kpl_jx_in, f"鍘熸暟鎹細{datas[:20]} 鏉垮潡锛歿blocks}") + blocks = list(blocks) + blocks.sort(key=lambda x: fblock_money.get(x), reverse=True) cls.__top_jx_blocks = blocks @classmethod @@ -386,9 +397,11 @@ @param datas: @return: """ + cls.top_out_list_cache = datas count = 0 blocks = set() for data in datas: + cls.__jx_blocks_in_money_dict[data[1]] = data[3] if data[1] in constant.KPL_INVALID_BLOCKS: continue if data[3] > -5e7: @@ -404,7 +417,7 @@ break # 璁板綍绮鹃�夋祦鍑烘棩蹇� async_log_util.info(logger_kpl_jx_out, f"鍘熸暟鎹細{datas[:10]} 鏉垮潡锛歿blocks}") - cls.__top_jx_out_blocks = blocks + cls.__top_jx_out_blocks = list(blocks) @classmethod def get_top_market_jingxuan_blocks(cls): @@ -456,6 +469,10 @@ else: return False, None + @classmethod + def get_jx_block_in_money(cls, block): + return cls.__jx_blocks_in_money_dict.get(block) + # 浠g爜鍘嗗彶娑ㄥ仠鍘熷洜涓庢澘鍧楃鐞� class CodesHisReasonAndBlocksManager: -- Gitblit v1.8.0