Administrator
2023-08-18 8a8cefbd8c7218a5c9ef8894e31ec496375a0483
l2/cancel_buy_strategy.py
@@ -471,14 +471,13 @@
        # 守护30s以外的数据
        if time_space <= constant.S_CANCEL_EXPIRE_TIME:
            return False, None
        l2_log.cancel_debug(code, "H级是否需要撤单,数据范围:{}-{} ", start_index, end_index)
        # 获取成交进度
        origin_progress_index, latest_progress_index = self.__get_traded_progress_cache(code)
        if latest_progress_index is None:
            latest_progress_index = -1
        # 监听的数据
        watch_indexs_dict = {}
        if start_index >= 1956:
            print("进入测试")
        # 初始化为1防止分母为0
        total_nums = 1
        if origin_progress_index is not None:
@@ -504,7 +503,7 @@
        processed_index, cancel_num = self.__get_compute_data_cache(code)
        l2_log.cancel_debug(code, "H级是否需要撤单,数据范围:{}-{} ", start_index, end_index)
        # 获取下单次数
        cancel_rate_threshold = self.__hCancelParamsManager.get_cancel_rate(volume_index)
        process_index = start_index
@@ -533,8 +532,10 @@
                val = data["val"]
                if L2DataUtil.is_limit_up_price_buy_cancel(val):
                    # 查询买入位置
                    l2_log.cancel_debug(code,"查询买入位置开始:{}",i)
                    buy_index = l2_data_source_util.L2DataSourceUtils.get_buy_index_with_cancel_data(code, data,
                                                                                                     local_today_num_operate_map)
                    l2_log.cancel_debug(code, "查询买入位置结束:{}",i)
                    if buy_index is not None and buy_index in watch_indexs_dict:
                        has_watch_canceled = True
                        cancel_num += data["re"] * val["num"]