From 591415530c68c82af20e2c658a77de9e78491147 Mon Sep 17 00:00:00 2001 From: admin <admin@example.com> Date: 星期三, 28 五月 2025 18:36:33 +0800 Subject: [PATCH] 修复 当前有意购买统计的 BUG --- strategy/basic_methods.py | 2 +- strategy/buying_strategy.py | 6 +++--- strategy/kpl_data_manager.py | 10 +++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/strategy/basic_methods.py b/strategy/basic_methods.py index 8dd866f..cdc5763 100644 --- a/strategy/basic_methods.py +++ b/strategy/basic_methods.py @@ -211,7 +211,7 @@ # 鍏呭垎浜ゆ槗閲忓叕寮� 鐢ㄤ簬璁$畻鏃ュ唴娑ㄥ箙娈电悊璁虹殑瀹夊叏浜ゆ槗閲忓�� def sufficient_volume(current_volume, yesterday_volume, today_growth): if today_growth > 0: - if current_volume > yesterday_volume * 0.8 * today_growth: + if current_volume > yesterday_volume * 0.5 * today_growth: return True else: return False diff --git a/strategy/buying_strategy.py b/strategy/buying_strategy.py index 004f81b..e17abe2 100644 --- a/strategy/buying_strategy.py +++ b/strategy/buying_strategy.py @@ -315,7 +315,7 @@ logger_info(f"閲嶅鐩镐氦姒傚康==={intersection_plate}") # 璋冪敤鍏呭垎浜ゆ槗閲忓嚱鏁� sufficient_volume = basic_methods.sufficient_volume(current_volume, k_line_data[0]['volume'], today_growth) - logger_info(f"銆恵k_line_data[0]['sec_name']}銆戝綋鏃ュ綋鏃堕噺鏄惁鐩稿娑ㄥ箙鍏呰冻锛�===銆恵sufficient_volume}銆� 锛佸綋鏃朵笌鏄ㄦ棩鎴愪氦鐜囧崰姣�:{round(current_volume/k_line_data[0]['volume'], 2)}%锛屽綋鏃ュ綋鏃舵�绘垚浜ら噺锛歿round(current_volume / 10000, 2)}涓囷紝鏄ㄦ棩鐨勬�绘垚浜ら噺{round(k_line_data[0]['volume'] / 10000, 2)}涓囷紝褰撴棩褰撴椂娑ㄥ箙锛歿today_growth}%銆�") + logger_info(f"銆恵k_line_data[0]['sec_name']}銆戝綋鏃ュ綋鏃堕噺鏄惁鐩稿娑ㄥ箙鍏呰冻锛�===銆恵sufficient_volume}銆� 锛佸綋鏃朵笌鏄ㄦ棩鎴愪氦鐜囧崰姣�:{round(current_volume/k_line_data[0]['volume']/100, 2)}%锛屽綋鏃ュ綋鏃舵�绘垚浜ら噺锛歿round(current_volume / 10000, 2)}涓囷紝鏄ㄦ棩鐨勬�绘垚浜ら噺{round(k_line_data[0]['volume'] / 10000, 2)}涓囷紝褰撴棩褰撴椂娑ㄥ箙锛歿today_growth}%銆�") logger_info(f"銆愭湁姒傚康銆�(娑ㄥ仠鍒楄〃涓寘鍚嚜韬蹇� 涓� 涓嶆槸鍞竴鍖呭惈姒傚康涓嶅彲鐢�) 锛佹渶鏂颁环: {current_price}锛岋紝褰撴棩褰撴椂娑ㄥ箙锛歿today_growth}%銆�") # 鏈夋蹇垫湁寮哄害瑙嗙晫 if strength_list_have_it is True: @@ -388,7 +388,7 @@ logger_info(f"褰撳墠鏈夋剰璐拱锛歿k_line_data[0]['sec_name']}锛屾湁鎰忚喘涔板垪琛細{data_cache.willing_buy_list}") if data_cache.have_plate_buy_times >= 1 and k_line_data[0]['sec_name'] not in data_cache.willing_buy_list: logger_info( - f"銆� beneficial銆戞湁姒傚康涔板叆宸茬粡 1 娆�,涓旀湭鏇捐繘鍏ヨ繃鏈夋剰璐拱鍒楄〃锛佷笉涔颁簡锛侊紒鍏徃鍚嶇О锛歿k_line_data[0]['sec_name']}锛�") + f"銆愪笉鍒┿�戞湁姒傚康涔板叆宸茬粡 1 娆�,涓旀湭鏇捐繘鍏ヨ繃鏈夋剰璐拱鍒楄〃锛佷笉涔颁簡锛侊紒鍏徃鍚嶇О锛歿k_line_data[0]['sec_name']}锛�") if len(intersection_plate) > 0: logger_info( f"銆愪笉鍒┿�戝悓姒傚康鍙拱涓�娆★紝涓嶄拱浜嗭紝鍏徃鍚嶇О锛歿k_line_data[0]['sec_name']}锛岄噸澶嶇浉浜ゆ蹇�==={intersection_plate}") @@ -556,7 +556,7 @@ k_line_data[0]['volume'], today_growth) logger_info( - f"銆恵k_line_data[0]['sec_name']}銆戝綋鏃ュ綋鏃堕噺鏄惁鐩稿娑ㄥ箙鍏呰冻锛�===銆恵sufficient_volume}銆� 锛佸綋鏃ュ綋鏃舵�绘垚浜ら噺锛歿round(current_volume / 10000, 2)}涓囷紝鏄ㄦ棩鐨勬�绘垚浜ら噺{round(k_line_data[0]['volume'] / 10000, 2)}涓囷紝褰撴棩褰撴椂娑ㄥ箙锛歿today_growth}%銆�") + f"銆恵k_line_data[0]['sec_name']}銆戝綋鏃ュ綋鏃堕噺鏄惁鐩稿娑ㄥ箙鍏呰冻锛�===銆恵sufficient_volume}銆� 锛佸綋鏃朵笌鏄ㄦ棩鎴愪氦鐜囧崰姣�:{round(current_volume/k_line_data[0]['volume']/100, 2)}%锛屽綋鏃ュ綋鏃舵�绘垚浜ら噺锛歿round(current_volume / 10000, 2)}涓囷紝鏄ㄦ棩鐨勬�绘垚浜ら噺{round(k_line_data[0]['volume'] / 10000, 2)}涓囷紝褰撴棩褰撴椂娑ㄥ箙锛歿today_growth}%銆�") if last_volume_to_growth_ratio < 1: logger_info( f"銆愭湁寮哄害 鏈夊皬閲忔崲澶ф定骞呫�戠灛鏃堕噺骞呮瘮< 1 锛佺灛鏃堕噺骞呮瘮锛歿round(last_volume_to_growth_ratio, 2)}%锛屾渶鏂颁环: {current_price}锛岀灛鏃舵定骞咃細{round(tick_growth, 2)}%锛屽綋鏃ュ綋鏃舵定骞咃細{today_growth}%,褰撳墠鏃堕棿锛歿current_created_at}銆�") diff --git a/strategy/kpl_data_manager.py b/strategy/kpl_data_manager.py index 62ff45f..03e9229 100644 --- a/strategy/kpl_data_manager.py +++ b/strategy/kpl_data_manager.py @@ -27,8 +27,11 @@ self.__load_data() def __filter_origin_data(self, data): - return (data[0], [x[1] for x in data[1][0]], - {p: [xx for xx in data[1][1][p]] for p in data[1][1]}) + """ + :param data: 鏍煎紡锛�(鏃堕棿,[鏁版嵁,]) + :return: + """ + return data def add_log(self, in_plates_info, plate_codes_info): oringin_data = (tool.get_now_time_str(), in_plates_info, plate_codes_info) @@ -74,4 +77,5 @@ if __name__ == '__main__': - KPLMarketStockHeatLogManager() + KPLMarketsSiftPlateLogManager().load_data() + # KPLMarketStockHeatLogManager() -- Gitblit v1.8.0