From a7a00145bb6d6fe6bdc41006aaebea75fe71e5af Mon Sep 17 00:00:00 2001 From: admin <admin@example.com> Date: 星期三, 26 二月 2025 17:39:48 +0800 Subject: [PATCH] bug修改 --- strategy/kpl_api.py | 51 +++++++++++++++++++++++---------------------------- 1 files changed, 23 insertions(+), 28 deletions(-) diff --git a/strategy/kpl_api.py b/strategy/kpl_api.py index 10a7707..d74b76b 100644 --- a/strategy/kpl_api.py +++ b/strategy/kpl_api.py @@ -306,38 +306,33 @@ # market_strong = get_market_strong() # print(f"market_strong==={market_strong}") + # 鑾峰彇娑ㄥ仠鏉垮潡鍚嶇О鍒楄〃骞跺瓨鍌ㄦ湰鍦扮殑鍑芥暟 def get_limit_up_block_names(): - # 鑾峰彇娑ㄥ仠淇℃伅鍒楄〃 - 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 = [] # 璁惧畾褰撳墠鏃堕棿鐐� now_time = datetime.datetime.now().strftime("%H:%M:%S") - # 寰幆娣诲姞娑ㄥ仠姒傚康 - 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} 娆�") - if now_time > data_cache.after_closing_time: - # print(f"鏀剁洏缁撴潫锛岃褰曞綋鍓嶆定鍋滄澘鍧�") - # 灏嗚幏鍙栧埌鐨勬定鍋滄蹇垫澘鍧楄浆JSON鏍煎紡骞跺瓨鍌ㄥ湪鏈湴鏂囦欢澶逛腑 - # 灏嗗瓧鍏歌浆鎹负JSON鏍煎紡鐨勫瓧绗︿覆 - json_data = json.dumps(limit_up_block_names) - # print(f"json_data=={json_data}") - if len(json_data) != 0: - # 鍐欏叆鏂囦欢 - with open(constant.KPL_LIMIT_UP_BLOCK_NAMES_PATH, 'w', encoding='utf-8') as f: - f.write(json_data) - return limit_up_block_names + # print(f"now_time===={now_time}") + if data_cache.opening_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) -- Gitblit v1.8.0