Administrator
2024-01-10 8580670a0368e0c0a99ba85d9c1e2bb3fa1d71e3
bug修复
1个文件已修改
14 ■■■■■ 已修改文件
l2/cancel_buy_strategy.py 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py
@@ -1224,7 +1224,7 @@
            return
        self.__last_trade_progress_dict[code] = index
        if not self.__is_l_down_can_cancel(code):
        if not self.__is_l_down_can_cancel(code, buy_single_index):
            # L后已经不能守护
            HourCancelBigNumComputer().start_compute_watch_indexes(code, buy_single_index)
@@ -1328,7 +1328,8 @@
                #     return True, total_data[-1]
            rate = round(canceled_num / total_num, 3)
            thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code)
            thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code,
                                                                            total_data[buy_exec_index]["val"]["time"])
            # 除开最大单的影响权重
            if not must_buy:
                temp_thresh_hold_rate = round((total_num - max_num) * 0.9 / total_num, 2)
@@ -1394,7 +1395,9 @@
                    else:
                        canceled_count_weight += WATCH_INDEX_WEIGHTS[-1]
            rate = round(canceled_count_weight / total_count_weight, 3)
            thresh_cancel_rate, must_buy = LCancelRateManager.get_cancel_rate(code, is_up=True)
            thresh_cancel_rate, must_buy = LCancelRateManager.get_cancel_rate(code,
                                                                              total_data[buy_exec_index]["val"]["time"],
                                                                              is_up=True)
            l2_log.l_cancel_debug(code, f"计算范围:{start_index}-{end_index},成交位临近已撤单比例:{rate}/{thresh_cancel_rate}")
            if rate >= thresh_cancel_rate:
                # 计算成交进度位置到当前下单位置的纯买额
@@ -1432,7 +1435,7 @@
        return False, None
    # L后是否还有可能撤单
    def __is_l_down_can_cancel(self, code):
    def __is_l_down_can_cancel(self, code, buy_exec_index):
        watch_indexes_info = self.__get_watch_indexes_cache(code)
        if not watch_indexes_info:
            return True
@@ -1454,7 +1457,8 @@
            total_nums += val["num"]
            if left_count > 0 and index < trade_index:
                total_deal_nums += val["num"]
        thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code)
        thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code,
                                                                        total_datas[buy_exec_index]["val"]["time"])
        if total_deal_nums / total_nums > 1 - thresh_hold_rate - 0.05:
            return False
        return True