Administrator
2025-03-20 7534d2cb9570836c2308b75314ba57c8eabc1261
cancel_strategy/s_l_h_cancel_strategy.py
@@ -567,7 +567,7 @@
    # 获取撤单比例,返回(撤单比例,是否必买)
    @classmethod
    def get_cancel_rate(cls, code, buy_exec_time, is_up=False, is_l_down_recomputed=False, buy_mode=None):
    def get_cancel_rate(cls, code, is_up=False, is_l_down_recomputed=False, buy_mode=None):
        try:
            must_buy = cls.__MustBuyCodesManager.is_in_cache(code)
            if buy_mode == OrderBeginPosInfo.MODE_RADICAL:
@@ -1479,8 +1479,7 @@
        # 计算监听的总条数
        total_num = 0
        max_num = 0
        thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code,
                                                                        total_data[buy_exec_index]["val"]["time"])
        thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code)
        for wi in watch_indexes:
            if str(wi) in after_place_order_index_dict:
@@ -1618,9 +1617,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,
                                                                              total_data[buy_exec_index]["val"]["time"],
                                                                              is_up=True)
            thresh_cancel_rate, must_buy = 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:
                # 计算成交进度位置到当前下单位置的纯买额
@@ -1773,8 +1770,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,
                                                                        total_datas[buy_exec_index]["val"]["time"])
        thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code)
        if total_deal_nums / total_nums > 1 - thresh_hold_rate - 0.05:
            return False
        return True