From b381f779ae142d4c63c89ed38942d5920e71b87e Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 07 七月 2025 15:12:10 +0800 Subject: [PATCH] 禁止扫入下单 --- cancel_strategy/s_l_h_cancel_strategy.py | 26 +++++++++++++++++--------- 1 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cancel_strategy/s_l_h_cancel_strategy.py b/cancel_strategy/s_l_h_cancel_strategy.py index 24ceeb4..970cd10 100644 --- a/cancel_strategy/s_l_h_cancel_strategy.py +++ b/cancel_strategy/s_l_h_cancel_strategy.py @@ -568,6 +568,14 @@ # 鑾峰彇鎾ゅ崟姣斾緥,杩斿洖锛堟挙鍗曟瘮渚�,鏄惁蹇呬拱锛� @classmethod def get_cancel_rate(cls, code, is_up=False, is_l_down_recomputed=False, buy_mode=None): + """ + + @param code: + @param is_up: + @param is_l_down_recomputed: + @param buy_mode: + @return: 鎾ゅ崟姣斾緥, 鏄惁鍔犵孩, (鍘熷��,浜轰负璁剧疆鐨勫��) + """ try: must_buy = cls.__MustBuyCodesManager.is_in_cache(code) if buy_mode == OrderBeginPosInfo.MODE_RADICAL: @@ -579,13 +587,13 @@ human_rate = 0 if must_buy: # 鎵叆鍔犵孩 - return max(constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, human_rate), True + return max(constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, human_rate), True, (constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, human_rate) else: # 鏍规嵁鎴愪氦棰濈殑澶у崟鎴愪氦鍗犳瘮鏉ヨ绠楁挙鍗曟瘮渚� big_money_rate = radical_buy_data_manager.TotalDealBigOrderInfoManager.get_big_order_rate(code) if big_money_rate is not None: threshold_rate = min(big_money_rate * 3, 0.8) - return max(threshold_rate, human_rate), False + return max(threshold_rate, human_rate), False, (threshold_rate, human_rate) else: deal_big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, gpcode_manager.get_limit_up_price_as_num( @@ -594,12 +602,12 @@ threshold_rate = 0.5 * deal_rate + 0.35 threshold_rate = max(threshold_rate, 0.375) threshold_rate = min(threshold_rate, 0.8) - return max(threshold_rate, human_rate), False + return max(threshold_rate, human_rate), False, (threshold_rate, human_rate) if must_buy: if is_up: - return constant.L_CANCEL_RATE_UP_WITH_MUST_BUY, True + return constant.L_CANCEL_RATE_UP_WITH_MUST_BUY, True, None else: - return constant.L_CANCEL_RATE_WITH_MUST_BUY, True + return constant.L_CANCEL_RATE_WITH_MUST_BUY, True, None except Exception as e: async_log_util.error(logger_l2_l_cancel, str(e)) @@ -629,7 +637,7 @@ base_rate += deal_rate except Exception as e: l2_log.l_cancel_debug(code, f"璁$畻鎾ゅ崟姣斾緥鍑洪敊锛歿e}") - return round(base_rate, 2), False + return round(base_rate, 2), False, None # 鑾峰彇L鍚庢垚浜ゅお蹇殑鎾ゅ崟姣斾緥 @classmethod @@ -1506,7 +1514,7 @@ # 璁$畻鐩戝惉鐨勬�绘潯鏁� total_num = 0 max_num, max_num_count = 0, 0 - thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code) + thresh_hold_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code) for wi in watch_indexes: if str(wi) in after_place_order_index_dict: @@ -1651,7 +1659,7 @@ else: canceled_count_weight += WATCH_INDEX_WEIGHTS[-1] rate = round(canceled_count_weight / total_count_weight, 3) - thresh_cancel_rate, must_buy = LCancelRateManager.get_cancel_rate(code, is_up=True) + thresh_cancel_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code, is_up=True) l2_log.l_cancel_debug(code, f"璁$畻鑼冨洿锛歿start_index}-{end_index},L鍓嶅凡鎾ゅ崟姣斾緥锛歿rate}/{thresh_cancel_rate}") if rate >= thresh_cancel_rate: # 璁$畻鎴愪氦杩涘害浣嶇疆鍒板綋鍓嶄笅鍗曚綅缃殑绾拱棰� @@ -1804,7 +1812,7 @@ total_nums += val["num"] if left_count > 0 and index < trade_index: total_deal_nums += val["num"] - thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code) + thresh_hold_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code) if total_deal_nums / total_nums > 1 - thresh_hold_rate - 0.05: return False return True -- Gitblit v1.8.0