From bea977458173f2e60971bad2d6f1e3183070c5ca Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 21 十月 2024 10:21:56 +0800 Subject: [PATCH] bug修改 --- l2/l2_data_manager_new.py | 22 ++++++++++++---------- cancel_strategy/s_l_h_cancel_strategy.py | 14 +++++++++----- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/cancel_strategy/s_l_h_cancel_strategy.py b/cancel_strategy/s_l_h_cancel_strategy.py index e3d10d9..fc73cd5 100644 --- a/cancel_strategy/s_l_h_cancel_strategy.py +++ b/cancel_strategy/s_l_h_cancel_strategy.py @@ -16,7 +16,7 @@ from utils import tool from l2.transaction_progress import TradeBuyQueue -from trade import l2_trade_factor, trade_record_log_util +from trade import l2_trade_factor, trade_record_log_util, trade_constant from l2 import l2_log, l2_data_source_util from l2.l2_data_util import L2DataUtil, local_today_datas, local_today_canceled_buyno_map, local_today_buyno_map from log_module.log import logger_l2_s_cancel, logger_debug, logger_l2_l_cancel, logger_l2_h_cancel @@ -1648,20 +1648,22 @@ def need_cancel(self, code, buy_exec_index, start_index, end_index, total_data, is_first_code): if buy_exec_index is None: - return False, None, "灏氭湭鎵惧埌涓嬪崟浣嶇疆" + return False, None, "灏氭湭鎵惧埌涓嬪崟浣嶇疆", None # 瀹堟姢S鎾や互澶栫殑鏁版嵁 if int(tool.get_now_time_str().replace(":", "")) > int("145700") and not constant.TEST: - return False, None, "" + return False, None, "", None try: LCancelOutOfDateWatchIndexesManager().process(code, start_index, end_index) except Exception as e: l2_log.l_cancel_debug("L鍚庣ǔ瀹氭洿鏂板嚭閿欙細{}", str(e)) # 涓嬪崟浣嶄复杩戞挙 - can_cancel, cancel_data = False, None + can_cancel, cancel_data, cancel_type = False, None, None try: can_cancel, cancel_data = self.__compute_need_cancel(code, buy_exec_index, start_index, end_index, total_data, is_first_code) + if can_cancel: + cancel_type = trade_constant.CANCEL_TYPE_L_DOWN except Exception as e: logger_l2_l_cancel.exception(e) raise e @@ -1673,6 +1675,8 @@ start_index, end_index, total_data, is_first_code) + if can_cancel: + cancel_type = trade_constant.CANCEL_TYPE_L_UP extra_msg = "L鍓�" except Exception as e: logger_l2_l_cancel.exception(e) @@ -1692,7 +1696,7 @@ except Exception as e: l2_log.l_cancel_debug(code, "L鍚庡悗鍗婃璁$畻鍑洪敊锛歿}", str(e)) - return can_cancel, cancel_data, extra_msg + return can_cancel, cancel_data, extra_msg, cancel_type def place_order_success(self, code): self.clear(code) diff --git a/l2/l2_data_manager_new.py b/l2/l2_data_manager_new.py index 4f35ed7..c47cea8 100644 --- a/l2/l2_data_manager_new.py +++ b/l2/l2_data_manager_new.py @@ -600,13 +600,14 @@ def l_cancel(_buy_single_index, _buy_exec_index): _start_time = round(t.time() * 1000) try: - b_need_cancel, b_cancel_data, extra_msg = cls.__LCancelBigNumComputer.need_cancel(code, - _buy_exec_index, - start_index, - end_index, total_data, - is_first_code) + b_need_cancel, b_cancel_data, extra_msg, b_cancel_type = cls.__LCancelBigNumComputer.need_cancel(code, + _buy_exec_index, + start_index, + end_index, + total_data, + is_first_code) if b_need_cancel and b_cancel_data: - return b_cancel_data, f"L鎾�({extra_msg})" + return b_cancel_data, f"L鎾�({extra_msg})", b_cancel_type except Exception as e: async_log_util.error(logger_l2_error, f"L鎾ゅ嚭閿� 鍙傛暟锛歜uy_single_index-{_buy_single_index} buy_exec_index-{_buy_exec_index} 閿欒鍘熷洜锛歿str(e)}") @@ -615,7 +616,7 @@ finally: # l2_data_log.l2_time(code, round(t.time() * 1000) - _start_time, "宸蹭笅鍗�-L鎾ゅぇ鍗曡绠�") pass - return None, "" + return None, "", None # G鎾� def g_cancel(_buy_single_index, _buy_exec_index): @@ -680,8 +681,8 @@ cancel_type = trade_constant.CANCEL_TYPE_G # 渚濇澶勭悊 if not cancel_data: - cancel_data, cancel_msg = l_cancel(order_begin_pos.buy_single_index, order_begin_pos.buy_exec_index) - cancel_type = trade_constant.CANCEL_TYPE_L + cancel_data, cancel_msg, cancel_type = l_cancel(order_begin_pos.buy_single_index, + order_begin_pos.buy_exec_index) # B鎾� if not cancel_data: cancel_data, cancel_msg = b_cancel(order_begin_pos.buy_single_index, order_begin_pos.buy_exec_index) @@ -1367,7 +1368,8 @@ if cancel_type != trade_constant.CANCEL_TYPE_HUMAN: # 鏄惁鏄氦鏄撻槦鍒楄Е鍙� # 鎵叆涓嬪崟鍙湁L鎾よ兘鎾ゅ崟 - if order_begin_pos and order_begin_pos.mode == OrderBeginPosInfo.MODE_RADICAL and cancel_type not in {trade_constant.CANCEL_TYPE_L_DOWN}: + if order_begin_pos and order_begin_pos.mode == OrderBeginPosInfo.MODE_RADICAL and cancel_type not in { + trade_constant.CANCEL_TYPE_L_DOWN, trade_constant.CANCEL_TYPE_L}: l2_log.cancel_debug(code, "鎾ゅ崟涓柇锛屽師鍥狅細{}", "鎵叆涓嬪崟涓嶆槸L鎾�") return False # 鍔犵豢鍙湁L鎾�/浜烘挙鐢熸晥 -- Gitblit v1.8.0