From 0b0d0e790fec8c7edfdbcab5c31d625e0c2eadd6 Mon Sep 17 00:00:00 2001 From: admin <admin@example.com> Date: 星期四, 19 六月 2025 16:54:49 +0800 Subject: [PATCH] 添加必要的数据日志 --- strategy/buying_strategy.py | 71 ++++++++++++++++++----------------- 1 files changed, 37 insertions(+), 34 deletions(-) diff --git a/strategy/buying_strategy.py b/strategy/buying_strategy.py index a52e947..a5230d6 100644 --- a/strategy/buying_strategy.py +++ b/strategy/buying_strategy.py @@ -249,6 +249,7 @@ async_log_util.info(logger, f"鍗曚竴鏉垮潡鍐呯灛鏃舵媺鍗囨暟涓猴細{len(values)}锛屽垎鍒负===={values}") # 濡傛灉瀛愬垪琛ㄩ暱搴﹀ぇ浜�1涓旂浜屼釜鍏冪礌鍖呭惈 褰撳墠杩涘叆娑ㄥ箙瑙嗙晫鐨剆ymbol_code + # 鏈夊己搴﹁鐣� strength_list_have_it = True strength_plate = correlation_plate_list if stock_list[6] >= 1: @@ -420,6 +421,16 @@ get_order_money(), k_line_data[0]['sec_name'], current_price) + # 浼犵粰GUI鏄剧ず + purchased_stock_details = { + "name": k_line_data[0]['sec_name'], + "policy_name": "鏈夋蹇垫湁寮哄害绛栫暐鍒嗘敮", + "plate_name": list(limit_up_plate_included), + "buy_time_trading_volume_ratio": ( + current_volume / k_line_data[0]['volume']), + } + data_cache.purchased_stocks_details_list.append(purchased_stock_details) + logger_info(f"宸叉垚浜よ偂绁ㄨ鎯呭垪琛細{data_cache.purchased_stocks_details_list} ") # 妫�娴嬫寔浠撲唬鐮侀泦鍚堜腑鏈夋棤涓嬪崟涓偂锛屾墠璁や负浜ゆ槗鎴愬姛 if symbol_code not in data_cache.position_symbols_set: logger_info( @@ -431,16 +442,6 @@ data_cache.bought_plate.extend(limit_up_plate_included_list) logger_info( f"銆恵k_line_data[0]['sec_name']}銆戜氦鏄撴垚鍔燂紒鎸佷粨闆嗗悎锛歿data_cache.position_symbols_set}") - # 浼犵粰GUI鏄剧ず - purchased_stock_details = { - "name": k_line_data[0]['sec_name'], - "policy_name": "鏈夋蹇垫湁寮哄害绛栫暐鍒嗘敮", - "plate_name": list(limit_up_plate_included), - "buy_time_trading_volume_ratio": (current_volume / k_line_data[0]['volume']), - } - data_cache.purchased_stocks_details_list.append(purchased_stock_details) - logger_info(f"宸叉垚浜よ偂绁ㄨ鎯呭垪琛細{data_cache.purchased_stocks_details_list} ") - # 鏈夋蹇垫棤寮哄害瑙嗙晫 if strength_list_have_it is False: logger_info( @@ -540,6 +541,17 @@ f"************************************************銆愭湁姒傚康鏃犲己搴︽寚鏍囦笅鍗曘��************************************************") logger_info( f"鏈�鏂颁环: {current_price}, 褰撴棩鏈�楂樹环锛歿current_high},鐬椂娑ㄥ箙: {tick_growth:.2f}%,鐬椂閲忓箙姣旓細{last_volume_to_growth_ratio:.2f}%,褰撴棩褰撴椂娑ㄥ箙锛歿today_growth}%锛屽叕鍙稿悕绉帮細{k_line_data[0]['sec_name']},褰撳墠鏃堕棿锛歿current_created_at},浣庝簬姘翠綅绾匡細{deep_low:.2f},浜ゆ槗閲忎粖鏃ヤ笌鏄ㄦ棩鐨勬瘮渚媨round(current_volume / k_line_data[0]['volume'], 2)}") + # 浼犵粰GUI鏄剧ず + purchased_stock_details = { + "name": k_line_data[0]['sec_name'], + "policy_name": "鏈夋蹇垫棤寮哄害绛栫暐鍒嗘敮", + "plate_name": list(limit_up_plate_included), + "buy_time_trading_volume_ratio": ( + current_volume / k_line_data[0]['volume']), + } + data_cache.purchased_stocks_details_list.append(purchased_stock_details) + logger_info( + f"宸叉垚浜よ偂绁ㄨ鎯呭垪琛細{data_cache.purchased_stocks_details_list} ") # 妫�娴嬫寔浠撲唬鐮侀泦鍚堜腑鏈夋棤涓嬪崟涓偂锛屾墠璁や负浜ゆ槗鎴愬姛 if symbol_code not in data_cache.position_symbols_set: logger_info( @@ -551,17 +563,7 @@ data_cache.bought_plate.extend(limit_up_plate_included_list) logger_info( f"銆恵k_line_data[0]['sec_name']}銆戜氦鏄撴垚鍔燂紒鎸佷粨闆嗗悎锛歿data_cache.position_symbols_set}") - # 浼犵粰GUI鏄剧ず - purchased_stock_details = { - "name": k_line_data[0]['sec_name'], - "policy_name": "鏈夋蹇垫棤寮哄害绛栫暐鍒嗘敮", - "plate_name": list(limit_up_plate_included), - "buy_time_trading_volume_ratio": ( - current_volume / k_line_data[0]['volume']), - } - data_cache.purchased_stocks_details_list.append(purchased_stock_details) - logger_info( - f"宸叉垚浜よ偂绁ㄨ鎯呭垪琛細{data_cache.purchased_stocks_details_list} ") + ''' 鏃犳蹇� 鏈夊己搴﹁鐣� ''' @@ -665,6 +667,18 @@ get_order_money(), k_line_data[0]['sec_name'], current_price) + # 浼犵粰GUI鏄剧ず + purchased_stock_details = { + "name": k_line_data[0]['sec_name'], + "policy_name": "鏃犳蹇垫湁寮哄害绛栫暐鍒嗘敮", + "plate_name": list(strength_plate), + "buy_time_trading_volume_ratio": ( + current_volume / k_line_data[0]['volume']), + } + data_cache.purchased_stocks_details_list.append( + purchased_stock_details) + logger_info( + f"宸叉垚浜よ偂绁ㄨ鎯呭垪琛細{data_cache.purchased_stocks_details_list} ") # 妫�娴嬫寔浠撲唬鐮侀泦鍚堜腑鏈夋棤涓嬪崟涓偂锛屾墠璁や负浜ゆ槗鎴愬姛 if symbol_code not in data_cache.position_symbols_set: logger_info( @@ -676,18 +690,7 @@ data_cache.bought_plate.extend(strength_plate) logger_info( f"銆恵k_line_data[0]['sec_name']}銆戜氦鏄撴垚鍔燂紒鎸佷粨闆嗗悎锛歿data_cache.position_symbols_set}") - # 浼犵粰GUI鏄剧ず - purchased_stock_details = { - "name": k_line_data[0]['sec_name'], - "policy_name": "鏃犳蹇垫湁寮哄害绛栫暐鍒嗘敮", - "plate_name": list(strength_plate), - "buy_time_trading_volume_ratio": ( - current_volume / k_line_data[0]['volume']), - } - data_cache.purchased_stocks_details_list.append( - purchased_stock_details) - logger_info( - f"宸叉垚浜よ偂绁ㄨ鎯呭垪琛細{data_cache.purchased_stocks_details_list} ") + ''' 鏃犳蹇垫棤寮哄害 鏈夊皬閲忔崲澶ф定骞呭害瑙嗙晫 ''' @@ -876,7 +879,7 @@ # 浠ヤ笅閮ㄥ垎涓昏璁$畻鏁翠綋鐨勮姳璐规椂闂� # 灏哻urrent_created_at杞崲涓篸atetime瀵硅薄锛岃繖閲屽亣璁炬槸浠婂ぉ鐨勬棩鏈� # 娉ㄦ剰锛氳繖閲屼娇鐢ㄤ簡datetime.now()鏉ヨ幏鍙栧綋鍓嶆棩鏈燂紝浣嗕綘鍙互鏍规嵁闇�瑕佽皟鏁� - created_at = datetime.datetime.strptime(tool.get_now_date_str() + " " + current_created_at, + created_at = datetime.datetime.strptime(data_cache.DataCache().today_date + " " + current_created_at, "%Y-%m-%d %H:%M:%S").timestamp() # print(f"created_at===={created_at}") # print(f"created_at type===={type(created_at)}") -- Gitblit v1.8.0