Administrator
2023-09-26 b96b94bc9d7419d2b2907789c41d2c84100e84b3
l2/cancel_buy_strategy.py
@@ -883,9 +883,9 @@
            return False, None
        watch_indexes = set([int(i) for i in watch_indexes])
        # 计算监听的总条数
        total_count = 0
        total_num = 0
        for wi in watch_indexes:
            total_count += total_data[wi]["re"]
            total_num += total_data[wi]["val"]["num"]*total_data[wi]["re"]
        # 判断撤单中是否有监听中的索引
        need_compute = False
        for i in range(start_index, end_index + 1):
@@ -902,19 +902,19 @@
            # 计算撤单比例
            watch_indexes_list = list(watch_indexes)
            watch_indexes_list.sort()
            canceled_count = 0
            canceled_num = 0
            for wi in watch_indexes:
                left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count(code,
                                                                                                      wi,
                                                                                                      total_data,
                                                                                                      _local_today_num_operate_map)
                canceled_count += total_data[wi]["re"] - left_count
                canceled_num += (total_data[wi]["re"] - left_count)*total_data[wi]["val"]["num"]
                # if wi == watch_indexes_list[-1] and left_count == 0:
                #     # 离下单位置最近的一个撤单,必须触发撤单
                #     l2_log.l_cancel_debug(code, f"计算范围:{start_index}-{end_index},临近撤单:{wi}")
                #     return True, total_data[-1]
            rate = round(canceled_count / total_count, 3)
            rate = round(canceled_num / total_num, 3)
            l2_log.l_cancel_debug(code, f"计算范围:{start_index}-{end_index},已撤单比例:{rate}")
            if rate >= constant.L_CANCEL_RATE:
                return True, total_data[-1]