| | |
| | | if int(total_data[buy_single_index]["val"]["time"].replace(":", "")) <= int( |
| | | buy_time.replace(":", "")): |
| | | # 买入时间在囊括范围内 |
| | | if tool.trade_time_sub(tool.trade_time_add_second(buy_exec_time, range_seconds), |
| | | total_data[buy_index]["val"]["time"]) >= 0: |
| | | if tool.trade_time_sub(tool.trade_time_add_second(buy_exec_time, range_seconds),buy_time) >= 0: |
| | | cancel_num += data["re"] * int(val["num"]) |
| | | |
| | | # 保存数据 |
| | |
| | | return True, total_data[i] |
| | | finally: |
| | | |
| | | l2_log.cancel_debug(code, "S级大单 范围:{}-{} 取消计算结果:{}/{},比例:{} 目标比例:{} 计算时间范围:{}", start_index, end_index, cancel_num, |
| | | buy_num, round(cancel_num / max(buy_num, 1), 2), cancel_rate_threshold,range_seconds) |
| | | l2_log.cancel_debug(code, "S级大单 范围:{}-{} 取消计算结果:{}/{},比例:{} 目标比例:{} 计算时间范围:{}", start_index, end_index, |
| | | cancel_num, |
| | | buy_num, round(cancel_num / max(buy_num, 1), 2), cancel_rate_threshold, range_seconds) |
| | | |
| | | # 保存处理进度与数据 |
| | | cls.__save_compute_data(code, process_index, buy_num, cancel_num) |
| | |
| | | finally: |
| | | l2_log.cancel_debug(code, "H级撤单计算结果 范围:{}-{} 处理进度:{} 取消计算结果:{}/{} 目标撤单比例:{}", start_index, end_index, |
| | | process_index, cancel_num, |
| | | total_nums,cancel_rate_threshold) |
| | | total_nums, cancel_rate_threshold) |
| | | logger_l2_h_cancel.info( |
| | | f"code-{code} H级撤单计算结果 范围:{start_index}-{end_index} 处理进度:{process_index} 目标比例:{cancel_rate_threshold} 取消计算结果:{cancel_num}/{total_nums}") |
| | | # 保存处理进度与数据 |
| | |
| | | if left_count > 0: |
| | | data = total_data[i] |
| | | val = data["val"] |
| | | if val["num"] * float(val["price"]) <= constant.H_CANCEL_MIN_MONEY*100: |
| | | if val["num"] * float(val["price"]) <= constant.H_CANCEL_MIN_MONEY * 100: |
| | | continue |
| | | total_count += left_count |
| | | watch_set.add((i, val["num"], left_count)) |
| | |
| | | if left_count > 0: |
| | | data = total_data[i] |
| | | val = data["val"] |
| | | if val["num"] * float(val["price"]) <= constant.H_CANCEL_MIN_MONEY*100: |
| | | if val["num"] * float(val["price"]) <= constant.H_CANCEL_MIN_MONEY * 100: |
| | | continue |
| | | total_count += left_count |
| | | watch_set.add((i, val["num"], left_count)) |
| | |
| | | if total_count >= MIN_H_COUNT and big_num_count >= constant.H_CANCEL_MIN_BIG_NUM_COUNT: # and total_num >= threshold_num |
| | | finished = True |
| | | l2_log.cancel_debug(code, "获取到H撤监听数据:{},计算截至位置:{},目标计算数量:{}", json.dumps(list(watch_set)), |
| | | total_data[-1]["index"],MIN_H_COUNT) |
| | | total_data[-1]["index"], MIN_H_COUNT) |
| | | break |
| | | |
| | | final_watch_list = list(watch_set) |