From 6503f578ea263b18ac01810e07b7acbc82f63a8f Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期一, 15 九月 2025 16:34:17 +0800
Subject: [PATCH] L后不足5笔撤单/建比>=40%时才采用新的下单方式

---
 cancel_strategy/s_l_h_cancel_strategy.py |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/cancel_strategy/s_l_h_cancel_strategy.py b/cancel_strategy/s_l_h_cancel_strategy.py
index 5bb4271..7b38b5f 100644
--- a/cancel_strategy/s_l_h_cancel_strategy.py
+++ b/cancel_strategy/s_l_h_cancel_strategy.py
@@ -1181,6 +1181,14 @@
 
     # 璁剧疆鐪熷疄涓嬪崟浣嶇疆
     def set_real_place_order_index(self, code, index, buy_single_index=None, is_default=False):
+        """
+        璁剧疆鐪熷疄涓嬪崟浣嶇疆
+        @param code:
+        @param index:
+        @param buy_single_index:
+        @param is_default:
+        @return: 鏄惁闇�瑕佹挙鍗�, 鎾ゅ崟鍘熷洜
+        """
         l2_log.l_cancel_debug(code, f"璁剧疆鐪熷疄涓嬪崟浣�-{index}锛宐uy_single_index-{buy_single_index}")
         self.__real_place_order_index_dict[code] = (index, is_default)
         RedisUtils.setex_async(self.__db, f"l_cancel_real_place_order_index-{code}", tool.get_expire(),
@@ -1193,7 +1201,15 @@
         if buy_single_index is not None:
             # L鍚庢挙浠庢垚浜よ繘搴︿綅寮�濮嬭绠�
             self.compute_watch_index(code, buy_single_index, trade_index, index)
-        self.__compute_trade_progress_near_by_indexes(code, buy_single_index, trade_index, index)
+            # 璁剧疆闈為粯璁ょ殑鐪熷疄涓嬪崟浣嶆椂锛屼笅鍗�1鍒嗛挓鍐咃紝L鍚庝笉瓒�5绗斿氨鎾ゅ崟
+            if not is_default:
+                total_datas = local_today_datas.get(code)
+                if tool.trade_time_sub(total_datas[-1]['val']['time'], total_datas[index]['val']['time']) < 60:
+                    watch_index_info = self.__cancel_watch_index_info_cache.get(code)
+                    if watch_index_info and len(watch_index_info) >= 3 and len(watch_index_info[2]) < 5:
+                        # 鎾ゅ崟
+                        return True, "L鍚庡泭鎷笉瓒�5绗�"
+        return False, ""
 
     # 閲嶆柊璁$畻L鍓�
     def re_compute_l_up_watch_indexes(self, code, buy_single_index):

--
Gitblit v1.8.0