From 0b0d0e790fec8c7edfdbcab5c31d625e0c2eadd6 Mon Sep 17 00:00:00 2001 From: admin <admin@example.com> Date: 星期四, 19 六月 2025 16:54:49 +0800 Subject: [PATCH] 添加必要的数据日志 --- strategy/basic_methods.py | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diff --git a/strategy/basic_methods.py b/strategy/basic_methods.py index a7b4c12..2af7d7b 100644 --- a/strategy/basic_methods.py +++ b/strategy/basic_methods.py @@ -88,6 +88,7 @@ if last_price != 0: growth = (price - last_price) / last_price * 100 # 璁$畻娑ㄥ箙鐧惧垎姣� return growth + finally: history_price[symbol] = price # print(f"price======={price}") @@ -184,7 +185,7 @@ def secure_volume(now_date_time): # 瀹氫箟鏃堕棿娈电殑寮�濮嬪拰缁撴潫鏃堕棿锛堜娇鐢ㄥ瓧绗︿覆鏍煎紡锛� time_slots = [ - (("09:30:00", "09:30:30"), 0.05), + (("09:30:00", "09:30:30"), 0.04), (("09:30:30", "09:31:00"), 0.08), (("09:31:00", "09:31:30"), 0.1), (("09:31:30", "09:32:00"), 0.15), @@ -207,9 +208,14 @@ return 0 -# 绀轰緥浣跨敤 -# now = datetime.now() -# print(f"secure_volume(now)=={secure_volume(now)}") +# 鍏呭垎浜ゆ槗閲忓叕寮� 鐢ㄤ簬璁$畻鏃ュ唴娑ㄥ箙娈电悊璁虹殑瀹夊叏浜ゆ槗閲忓�� +def sufficient_volume(current_volume, yesterday_volume, today_growth): + if today_growth > 0 and round(current_volume / yesterday_volume, 2) >= 0.01: + if current_volume > yesterday_volume * (today_growth/10) * 0.5: + return True + else: + return False + # 璁$畻 濮斾拱鍜屽鍗栫殑姣斾緥鍑芥暟(鑾峰彇涔扮洏寮哄害鏁版嵁)銆愭帢閲戞暟鎹粨鏋勩�� def buying_and_selling_ratio(current_quotes): @@ -253,3 +259,9 @@ else: buying_ratio = 0.01 return buying_ratio + + +# 缁熻鏈夋剰涔拌偂绁ㄥ嚭鐜版鏁板嚱鏁� +def count_willing_buy_times(sec_name): + willing_buy_times = data_cache.willing_buy_list.count(sec_name) + return willing_buy_times \ No newline at end of file -- Gitblit v1.8.0