| | |
| | | import constant |
| | | import inited_data |
| | | import outside_api_command_manager |
| | | from cancel_strategy.s_l_h_cancel_strategy import SCancelBigNumComputer |
| | | from cancel_strategy.s_l_h_cancel_strategy import SCancelBigNumComputer, LCancelRateManager |
| | | from code_attribute import gpcode_manager, code_volumn_manager, zyltgb_util |
| | | from code_attribute.code_data_util import ZYLTGBUtil |
| | | from code_attribute.code_l1_data_manager import L1DataManager |
| | |
| | | break |
| | | except: |
| | | pass |
| | | # L撤比例 |
| | | l_down_cancel_rate, must_buy = LCancelRateManager.get_cancel_rate(code) |
| | | fdata = {"id": orderSysID, "code_info": (code, code_name), "total_num": total_nums, |
| | | "finish_num": deal_or_cancel_num, |
| | | "buy1_money": output_util.money_desc(buy1_money), |
| | |
| | | "limit_up_price": gpcode_manager.get_limit_up_price_as_num(code), |
| | | "is_near_big_order": is_near_big_order, |
| | | "block": '', |
| | | "trade_queue": [] |
| | | "trade_queue": [], |
| | | "l_down_cancel_rate":l_down_cancel_rate |
| | | } |
| | | limit_up_data = kpl_data_manager.KPLLimitUpDataRecordManager.record_code_dict.get(code) |
| | | # 获取当前板块 |
| | |
| | | |
| | | # 获取撤单比例,返回(撤单比例,是否必买) |
| | | @classmethod |
| | | def get_cancel_rate(cls, code, buy_exec_time, is_up=False, is_l_down_recomputed=False, buy_mode=None): |
| | | def get_cancel_rate(cls, code, is_up=False, is_l_down_recomputed=False, buy_mode=None): |
| | | try: |
| | | must_buy = cls.__MustBuyCodesManager.is_in_cache(code) |
| | | if buy_mode == OrderBeginPosInfo.MODE_RADICAL: |
| | |
| | | # 计算监听的总条数 |
| | | total_num = 0 |
| | | max_num = 0 |
| | | thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code, |
| | | total_data[buy_exec_index]["val"]["time"]) |
| | | thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code) |
| | | |
| | | for wi in watch_indexes: |
| | | if str(wi) in after_place_order_index_dict: |
| | |
| | | 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, |
| | | total_data[buy_exec_index]["val"]["time"], |
| | | 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},L前已撤单比例:{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, must_buy = LCancelRateManager.get_cancel_rate(code, |
| | | total_datas[buy_exec_index]["val"]["time"]) |
| | | 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 |