| | |
| | | l2_log.l_cancel_debug(code, "将L2后后半段备用大单加入计算出错:{}", str(e)) |
| | | # 计算监听的总条数 |
| | | total_num = 0 |
| | | max_num = 0 |
| | | max_num, max_num_count = 0, 0 |
| | | thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code) |
| | | |
| | | for wi in watch_indexes: |
| | |
| | | total_num += total_data[wi]["val"]["num"] * total_data[wi]["re"] |
| | | if total_data[wi]["val"]["num"] > max_num: |
| | | max_num = total_data[wi]["val"]["num"] |
| | | max_num_count = 1 |
| | | elif total_data[wi]["val"]["num"] == max_num: |
| | | max_num_count += 1 |
| | | # 判断撤单中是否有监听中的索引 |
| | | need_compute = False |
| | | for i in range(start_index, end_index + 1): |
| | |
| | | |
| | | # 除开最大单的影响权重 |
| | | if not must_buy: |
| | | temp_thresh_hold_rate = round((total_num - max_num) * 0.9 / total_num, 2) |
| | | temp_thresh_hold_rate = round((total_num - max_num * max_num_count) * 0.9 / total_num, 2) |
| | | if thresh_hold_rate > temp_thresh_hold_rate: |
| | | # 目标撤单比例大于大单撤单比例就取比例均值 |
| | | thresh_hold_rate = round((thresh_hold_rate + temp_thresh_hold_rate) / 2, 2) |
| | | |
| | | l2_log.l_cancel_debug(code, |
| | | f"L后计算范围:{start_index}-{end_index},已撤单比例:{rate}/{thresh_hold_rate}, 下单位之后的索引:{after_place_order_index_dict}") |
| | | f"L后计算范围:{start_index}-{end_index},已撤单比例:{rate}/{thresh_hold_rate}, 下单位之后的索引:{after_place_order_index_dict}, 最大单-({max_num},{max_num_count})") |
| | | if rate >= thresh_hold_rate: |
| | | canceled_indexes.sort() |
| | | l2_log.l_cancel_debug(code, f"L后撤单,撤单位置:{canceled_indexes[-1]}") |
| | |
| | | if not watch_indexes: |
| | | return False, None, "无大单监听" |
| | | total_datas = local_today_datas.get(code) |
| | | if tool.trade_time_sub(total_datas[start_index]["val"]["time"] ,total_datas[list(watch_indexes)[0]]["val"]["time"]) > 60: |
| | | if tool.trade_time_sub(total_datas[start_index]["val"]["time"], |
| | | total_datas[list(watch_indexes)[0]]["val"]["time"]) > 60: |
| | | return False, None, "只有前60s生效" |
| | | |
| | | cancel_indexes = set() |
| | |
| | | if total_left_money < 1e8: |
| | | if total_left_count <= 1 or ( |
| | | total_left_count <= THRESHOLD_COUNT and limit_up_price and total_left_num * float( |
| | | limit_up_price) < THRESHOLD_MONEY_W * 100): |
| | | limit_up_price) < THRESHOLD_MONEY_W * 100): |
| | | return True, f"剩余笔数({total_left_count})/金额({round(total_left_num * float(limit_up_price) * 100)})不足,成交进度:{trade_index},真实下单位置:{real_order_index} 阈值:({THRESHOLD_MONEY_W},{THRESHOLD_COUNT}) " |
| | | return False, f"不满足撤单条件: 成交进度-{trade_index} 真实下单位置-{real_order_index} total_left_count-{total_left_count} total_left_num-{total_left_num}" |
| | | |