From 9949e2de0c9f0624a0698a305b5d3ad52799e906 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期五, 27 六月 2025 15:42:53 +0800
Subject: [PATCH] L撤bug修改/RD撤生效时间设置为60s

---
 cancel_strategy/s_l_h_cancel_strategy.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/cancel_strategy/s_l_h_cancel_strategy.py b/cancel_strategy/s_l_h_cancel_strategy.py
index 3ea367d..57ffc7b 100644
--- a/cancel_strategy/s_l_h_cancel_strategy.py
+++ b/cancel_strategy/s_l_h_cancel_strategy.py
@@ -1478,7 +1478,7 @@
             l2_log.l_cancel_debug(code, "灏哃2鍚庡悗鍗婃澶囩敤澶у崟鍔犲叆璁$畻鍑洪敊锛歿}", str(e))
         # 璁$畻鐩戝惉鐨勬�绘潯鏁�
         total_num = 0
-        max_num = 0
+        max_num, max_num_count = 0, 0
         thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code)
 
         for wi in watch_indexes:
@@ -1497,6 +1497,9 @@
             total_num += total_data[wi]["val"]["num"] * total_data[wi]["re"]
             if total_data[wi]["val"]["num"] > max_num:
                 max_num = total_data[wi]["val"]["num"]
+                max_num_count = 1
+            elif total_data[wi]["val"]["num"] == max_num:
+                max_num_count += 1
         # 鍒ゆ柇鎾ゅ崟涓槸鍚︽湁鐩戝惉涓殑绱㈠紩
         need_compute = False
         for i in range(start_index, end_index + 1):
@@ -1548,13 +1551,13 @@
 
             # 闄ゅ紑鏈�澶у崟鐨勫奖鍝嶆潈閲�
             if not must_buy:
-                temp_thresh_hold_rate = round((total_num - max_num) * 0.9 / total_num, 2)
+                temp_thresh_hold_rate = round((total_num - max_num * max_num_count) * 0.9 / total_num, 2)
                 if thresh_hold_rate > temp_thresh_hold_rate:
                     # 鐩爣鎾ゅ崟姣斾緥澶т簬澶у崟鎾ゅ崟姣斾緥灏卞彇姣斾緥鍧囧��
                     thresh_hold_rate = round((thresh_hold_rate + temp_thresh_hold_rate) / 2, 2)
 
             l2_log.l_cancel_debug(code,
-                                  f"L鍚庤绠楄寖鍥达細{start_index}-{end_index},宸叉挙鍗曟瘮渚嬶細{rate}/{thresh_hold_rate}, 涓嬪崟浣嶄箣鍚庣殑绱㈠紩锛歿after_place_order_index_dict}")
+                                  f"L鍚庤绠楄寖鍥达細{start_index}-{end_index},宸叉挙鍗曟瘮渚嬶細{rate}/{thresh_hold_rate}, 涓嬪崟浣嶄箣鍚庣殑绱㈠紩锛歿after_place_order_index_dict}, 鏈�澶у崟-({max_num}锛寋max_num_count})")
             if rate >= thresh_hold_rate:
                 canceled_indexes.sort()
                 l2_log.l_cancel_debug(code, f"L鍚庢挙鍗�,鎾ゅ崟浣嶇疆锛歿canceled_indexes[-1]}")

--
Gitblit v1.8.0