From ad615df734b4d82f9a83a7d1805ac9fabdf01a53 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期四, 21 八月 2025 18:27:39 +0800
Subject: [PATCH] 200元股价以下的不足4手算4手/撤单率设置为100%不计算L后后半段撤单

---
 cancel_strategy/s_l_h_cancel_strategy.py |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/cancel_strategy/s_l_h_cancel_strategy.py b/cancel_strategy/s_l_h_cancel_strategy.py
index 909d4bd..6147084 100644
--- a/cancel_strategy/s_l_h_cancel_strategy.py
+++ b/cancel_strategy/s_l_h_cancel_strategy.py
@@ -1719,15 +1719,8 @@
         super_big_num_thresold = int(2e7 / gpcode_manager.get_limit_up_price_as_num(code) / 100)
         for wi in watch_indexes:
             if str(wi) in after_place_order_index_dict:
-                # 濡傛灉鍔犵孩灏遍渶瑕佽绠楀垎姣�
-                if must_buy:
-                    total_num += total_data[wi]["val"]["num"] * (
-                            10 - after_place_order_index_dict[str(wi)]) // 10
                 continue
             elif str(wi) in after_place_order_index_by_dict:
-                if must_buy:
-                    total_num += total_data[wi]["val"]["num"] * (
-                            10 - after_place_order_index_by_dict[str(wi)]) // 10
                 continue
             if total_data[wi]["val"]["num"] < super_big_num_thresold:
                 total_num += total_data[wi]["val"]["num"]
@@ -1767,15 +1760,23 @@
             if is_default:
                 trade_index = None
             canceled_buyno_map = local_today_canceled_buyno_map.get(code)
+
+            # 濡傛灉鎾ゅ崟姣斾緥璁剧疆涓�100%灏变笉闇�瑕佽绠椾笅鍗曚綅鍚庨潰鐨勮鍗�
+            need_compute_after = abs(thresh_hold_rate - 1.00) > 0.0001
+
             for wi in watch_indexes:
                 cancel_data = L2DataComputeUtil.is_canceled(code, wi, total_data, canceled_buyno_map, trade_index,
                                                             deal_order_nos)
                 if cancel_data:
                     if str(wi) in after_place_order_index_dict:
+                        if not need_compute_after:
+                            continue
                         # 鐪熷疄涓嬪崟浣嶇疆涔嬪悗鐨勬寜鐓ф潈閲嶆瘮渚嬫潵璁$畻
                         canceled_num += total_data[wi]["val"]["num"] * (
                                 10 - after_place_order_index_dict[str(wi)]) // 10
                     elif str(wi) in after_place_order_index_by_dict:
+                        if not need_compute_after:
+                            continue
                         canceled_num += total_data[wi]["val"]["num"] * (
                                 10 - after_place_order_index_by_dict[str(wi)]) // 10
                     else:
@@ -2052,19 +2053,20 @@
             logger_l2_l_cancel.exception(e)
             raise e
         extra_msg = "L鍚�"
-        if not can_cancel:
-            # 鎴愪氦浣嶄复杩戞挙
-            try:
-                can_cancel, cancel_data = self.__compute_near_by_trade_progress_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_UP
-                extra_msg = "L鍓�"
-            except Exception as e:
-                logger_l2_l_cancel.exception(e)
-                raise e
+        # 涓嶉渶瑕佽绠桳鍓�
+        # if not can_cancel:
+        #     # 鎴愪氦浣嶄复杩戞挙
+        #     try:
+        #         can_cancel, cancel_data = self.__compute_near_by_trade_progress_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_UP
+        #         extra_msg = "L鍓�"
+        #     except Exception as e:
+        #         logger_l2_l_cancel.exception(e)
+        #         raise e
 
         try:
             if self.__need_update_l_down_after(code, start_index, end_index):

--
Gitblit v1.8.0