| | |
| | | __big_num_deal_rate_dict = {} |
| | | __MustBuyCodesManager = gpcode_manager.MustBuyCodesManager() |
| | | |
| | | # 获取撤单比例 |
| | | # 获取撤单比例,返回(撤单比例,是否必买) |
| | | @classmethod |
| | | def get_cancel_rate(cls, code, is_up=False): |
| | | try: |
| | | must_buy_cancel_rate = cls.__MustBuyCodesManager.get_cancel_rate_cache(code) |
| | | if must_buy_cancel_rate is not None: |
| | | return must_buy_cancel_rate |
| | | return must_buy_cancel_rate, True |
| | | except Exception as e: |
| | | async_log_util.error(logger_l2_l_cancel, str(e)) |
| | | |
| | |
| | | base_rate += deal_rate |
| | | except Exception as e: |
| | | l2_log.l_cancel_debug(code, f"计算撤单比例出错:{e}") |
| | | return round(base_rate, 2) |
| | | return round(base_rate, 2), False |
| | | |
| | | # 设置板块涨停数量(除开自己) |
| | | @classmethod |
| | |
| | | # return True, total_data[-1] |
| | | |
| | | rate = round(canceled_num / total_num, 3) |
| | | thresh_hold_rate = LCancelRateManager.get_cancel_rate(code) |
| | | thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code) |
| | | # 除开最大单的影响权重 |
| | | temp_thresh_hold_rate = round((total_num - max_num)*0.9/total_num, 2) |
| | | thresh_hold_rate = min(thresh_hold_rate, temp_thresh_hold_rate) |
| | | if not must_buy: |
| | | temp_thresh_hold_rate = round((total_num - max_num) * 0.9 / total_num, 2) |
| | | thresh_hold_rate = min(thresh_hold_rate, temp_thresh_hold_rate) |
| | | l2_log.l_cancel_debug(code, f"计算范围:{start_index}-{end_index},已撤单比例:{rate}/{thresh_hold_rate}") |
| | | if rate >= thresh_hold_rate: |
| | | canceled_indexes.sort() |
| | |
| | | else: |
| | | canceled_count_weight += WATCH_INDEX_WEIGHTS[-1] |
| | | rate = round(canceled_count_weight / total_count_weight, 3) |
| | | thresh_cancel_rate = LCancelRateManager.get_cancel_rate(code, is_up=True) |
| | | thresh_cancel_rate, must_buy = LCancelRateManager.get_cancel_rate(code, is_up=True) |
| | | l2_log.l_cancel_debug(code, f"计算范围:{start_index}-{end_index},成交位临近已撤单比例:{rate}/{thresh_cancel_rate}") |
| | | if rate >= thresh_cancel_rate: |
| | | # 计算成交进度位置到当前下单位置的纯买额 |
| | |
| | | total_nums += val["num"] |
| | | if left_count > 0 and index < trade_index: |
| | | total_deal_nums += val["num"] |
| | | thresh_hold_rate = LCancelRateManager.get_cancel_rate(code) |
| | | thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code) |
| | | if total_deal_nums / total_nums > 1 - thresh_hold_rate - 0.05: |
| | | return False |
| | | return True |