Administrator
2025-06-26 f493380f308629e06ee0463c884912a457c1edc9
l2/cancel_buy_strategy.py
@@ -315,28 +315,13 @@
        @param end_index:
        @return: 是否需要撤单,撤单索引, 消息
        """
        buyno_map = local_today_buyno_map.get(code)
        watch_indexes = self.__watch_indexes_cache.get(code)
        if not watch_indexes:
            return False, None, "无大单监听"
        total_datas = local_today_datas.get(code)
        need_compute = False
        for i in range(start_index, end_index + 1):
            data = total_datas[i]
            val = data["val"]
            if not L2DataUtil.is_limit_up_price_buy_cancel(val):
                continue
            if val["num"] * float(val["price"]) < 5000:
                continue
            buy_index = l2_data_source_util.L2DataSourceUtils.get_buy_index_with_cancel_data_v2(data, buyno_map)
            if buy_index is None:
                continue
            if buy_index in watch_indexes:
                need_compute = True
                break
        cancel_indexes = set()
        canceled_buyno_map = local_today_canceled_buyno_map.get(code)
        if need_compute or True:
        if True:
            cancel_count = 0
            cancel_data = None
            # 成交买单号
@@ -352,6 +337,8 @@
                    # 买单已撤单
                    cancel_count += 1
                    cancel_indexes.add(index)
            if cancel_indexes:
                l2_log.d_cancel_debug(code, f"已撤单:{cancel_indexes}")
            rate = round(cancel_count / len(watch_indexes), 2)
            if rate >= 0.8:
                return True, cancel_data, f"撤单比例-{rate},大单撤单({cancel_indexes})"
@@ -359,6 +346,7 @@
    def __clear_data(self, code):
        if code in self.__watch_indexes_cache:
            l2_log.d_cancel_debug(code, f"清除大单监听")
            self.__watch_indexes_cache.pop(code)
            RedisUtils.delete_async(self.__db, f"radical_big_order_watch-{code}")