From ff14ed4736013d224ddd6582e8229a01074d542f Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期三, 19 六月 2024 18:13:44 +0800
Subject: [PATCH] L前的比例修改

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

diff --git a/cancel_strategy/s_l_h_cancel_strategy.py b/cancel_strategy/s_l_h_cancel_strategy.py
index 3d15672..cb3eb42 100644
--- a/cancel_strategy/s_l_h_cancel_strategy.py
+++ b/cancel_strategy/s_l_h_cancel_strategy.py
@@ -529,6 +529,7 @@
 # ---------------------------------L鎾�-------------------------------
 class LCancelRateManager:
     __block_limit_up_count_dict = {}
+    __block_limit_up_count_for_l_up_dict = {}
     __big_num_deal_rate_dict = {}
     __MustBuyCodesManager = gpcode_manager.MustBuyCodesManager()
 
@@ -548,10 +549,15 @@
         base_rate = constant.L_CANCEL_RATE
         if is_up:
             base_rate = constant.L_CANCEL_RATE_UP
+            if tool.is_sh_code(code):
+                base_rate = constant.L_CANCEL_RATE_UP_SH
         try:
             block_rate = 0
-            if code in cls.__block_limit_up_count_dict:
-                count = cls.__block_limit_up_count_dict[code]
+            count_dict = cls.__block_limit_up_count_dict
+            if is_up:
+                count_dict = cls.__block_limit_up_count_for_l_up_dict
+            if code in count_dict:
+                count = count_dict[code]
                 rates = [0, 0.03, 0.06, 0.08, 0.12]
                 if count >= len(rates):
                     block_rate = rates[-1]
@@ -578,11 +584,20 @@
 
     # 璁剧疆鏉垮潡娑ㄥ仠鏁伴噺锛堥櫎寮�鑷繁锛�
     @classmethod
-    def set_block_limit_up_count(cls, reason_codes_dict):
+    def set_block_limit_up_count(cls, reason_codes_dict, limit_up_time_dict: dict):
         for reason in reason_codes_dict:
             codes = reason_codes_dict[reason]
-            for c in codes:
+            codes = list(codes)
+            # 鐩爣绁ㄥ湪纭鐨勬定鍋滃師鍥犱腑锛屽湪鎬荤殑韬綅鐨勨墹50%浠ュ锛屽垯L鍓嶇殑娑ㄥ仠褰卞搷姣斾緥鍥犵礌涓嶇敓鏁堛��
+            codes.sort(key=lambda x: (
+                int(limit_up_time_dict.get(x).replace(":", "")) if x in limit_up_time_dict else int("150000")))
+            for i in range(len(codes)):
+                c = codes[i]
                 cls.__block_limit_up_count_dict[c] = len(codes) - 1
+                if i < len(codes) / 2:
+                    cls.__block_limit_up_count_for_l_up_dict[c] = len(codes) - 1
+                else:
+                    cls.__block_limit_up_count_for_l_up_dict[c] = 0
 
     @classmethod
     def set_big_num_deal_info(cls, code, buy_money, sell_money):
@@ -834,6 +849,8 @@
                     # 鍙栧悗1/5鐨勬暟鎹�
                     if temp_count >= 30:
                         temp_index = int(temp_count * 4 / 5)
+                        if tool.is_sh_code(code):  # 涓婅瘉鍙栧悗3/10
+                            temp_index = int(temp_count * 7 / 10)
                         re_start_index = not_cancel_indexes_with_num[temp_index][0]
                         MAX_COUNT = len(not_cancel_indexes_with_num[temp_index:])
                     else:
@@ -1487,7 +1504,7 @@
                 # 鏇存柊鍚庡崐娈�
                 watch_indexes = self.__compute_l_down_watch_index_after_real_place_order_index(code)
                 if watch_indexes:
-                    l2_log.l_cancel_debug(code,"L鍚庡悗鍗婃鍥婃嫭锛歿}", watch_indexes)
+                    l2_log.l_cancel_debug(code, "L鍚庡悗鍗婃鍥婃嫭锛歿}", watch_indexes)
                     watch_indexes_info = self.__get_watch_indexes_cache(code)
                     if watch_indexes_info and watch_indexes_info[2]:
                         # 娌℃湁鍥婃嫭

--
Gitblit v1.8.0