| | |
| | | |
| | | processed_index, cancel_num = self.__get_compute_data_cache(code) |
| | | |
| | | |
| | | # 获取下单次数 |
| | | cancel_rate_threshold = self.__hCancelParamsManager.get_cancel_rate(volume_index) |
| | | process_index = start_index |
| | |
| | | val = data["val"] |
| | | if L2DataUtil.is_limit_up_price_buy_cancel(val): |
| | | # 查询买入位置 |
| | | l2_log.cancel_debug(code,"查询买入位置开始:{}",i) |
| | | 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) |
| | | 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"] |
| | |
| | | return |
| | | |
| | | watch_indexes = set() |
| | | # 小金额 |
| | | watch_indexes_small_money = set() |
| | | for i in range(index + 1, total_data[-1]["index"] + 1): |
| | | data = total_data[i] |
| | | val = data['val'] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | if val["num"] * float(val["price"]) <= constant.L_CANCEL_MIN_MONEY * 100: |
| | | money = val["num"] * float(val["price"]) |
| | | if money <= constant.L_CANCEL_MIN_MONEY * 100: |
| | | continue |
| | | is_small_money = money < constant.L_CANCEL_BIG_MONEY * 100 |
| | | |
| | | if len( |
| | | watch_indexes_small_money) >= constant.L_CANCEL_MIN_MONEY_COUNT and is_small_money: |
| | | # 小金额的个数已满 |
| | | continue |
| | | |
| | | cancel_datas = local_today_num_operate_map.get( |
| | | "{}-{}-{}".format(val["num"], "1", val["price"])) |
| | | canceled = False |
| | |
| | | break |
| | | if not canceled: |
| | | watch_indexes.add(i) |
| | | if is_small_money: |
| | | # 添加小金额 |
| | | watch_indexes_small_money.add(i) |
| | | |
| | | if len(watch_indexes) >= constant.L_CANCEL_MAX_WATCH_COUNT: |
| | | break |
| | | logger_l2_l_cancel.info(f"{code}:设置监听范围,成交进度-{index} 监听范围-{watch_indexes}") |
| | |
| | | # 计算监听的总条数 |
| | | total_num = 0 |
| | | for wi in watch_indexes: |
| | | total_num += total_data[wi]["re"]*int(total_data[wi]["val"]["num"]) |
| | | total_num += total_data[wi]["re"] * int(total_data[wi]["val"]["num"]) |
| | | # 判断撤单中是否有监听中的索引 |
| | | need_compute = False |
| | | for i in range(start_index, end_index + 1): |