| | |
| | | if val["num"] < min_num: |
| | | continue |
| | | |
| | | if val["num"] < bigger_num: |
| | | continue |
| | | |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(code, i, |
| | | total_datas, |
| | | local_today_canceled_buyno_map.get( |
| | |
| | | break |
| | | self.__l_down_after_by_big_order_dict[code] = watch_indexes |
| | | l2_log.l_cancel_debug(code, f"L后后半段大单备用囊括范围:{watch_indexes}") |
| | | |
| | | try: |
| | | watch_indexes_info = self.get_l_down_watch_indexes_cache(code) |
| | | if watch_indexes_info: |
| | | total_watch_indexes = set(watch_indexes) | set(watch_indexes_info[2]) |
| | | trade_record_log_util.add_cancel_watch_indexes_log(code, |
| | | trade_record_log_util.CancelWatchIndexesInfo( |
| | | trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_L_DOWN, |
| | | watch_indexes_info[0], |
| | | list(total_watch_indexes))) |
| | | except: |
| | | pass |
| | | |
| | | # 设置真实下单位置 |
| | | def set_real_place_order_index(self, code, index, buy_single_index=None, is_default=False): |
| | |
| | | # 守护S撤以外的数据 |
| | | if int(tool.get_now_time_str().replace(":", "")) > int("145700") and not constant.TEST: |
| | | return False, None, "" |
| | | try: |
| | | LCancelOutOfDateWatchIndexesManager().process(code, start_index, end_index) |
| | | except Exception as e: |
| | | l2_log.l_cancel_debug("L后稳定更新出错:{}",str(e)) |
| | | # 下单位临近撤 |
| | | can_cancel, cancel_data = False, None |
| | | try: |
| | |
| | | """ |
| | | __latest_cancel_time_dict = {} |
| | | |
| | | __instance = None |
| | | |
| | | def __new__(cls, *args, **kwargs): |
| | | if not cls.__instance: |
| | | cls.__instance = super(LCancelOutOfDateWatchIndexesManager, cls).__new__(cls, *args, **kwargs) |
| | | return cls.__instance |
| | | |
| | | @classmethod |
| | | def compute_latest_canceled_watch_index_time(cls, code, watch_indexes): |
| | | """ |
| | |
| | | return total_datas[max_cancel_index]["val"]["time"] |
| | | |
| | | @classmethod |
| | | def compute_l_down_common_watch_indexes(cls, code, start_index, end_index, max_count, min_num, exclude_watch_indexes): |
| | | def compute_l_down_common_watch_indexes(cls, code, start_index, end_index, max_count, min_num, |
| | | exclude_watch_indexes): |
| | | """ |
| | | 获取L后监听数据 |
| | | @param code: |
| | |
| | | if tool.trade_time_sub(total_datas[-1]["val"]["time"], self.__latest_cancel_time_dict.get(code)) < 10 * 60: |
| | | # 最近的撤单时间小于10分钟 |
| | | return |
| | | # TODO 查找是否有相同时间的撤单且撤单时间在10分钟之前 |
| | | l2_log.l_cancel_debug(code, f"L后稳定") |
| | | canceled_buyno_map = local_today_canceled_buyno_map.get(code) |
| | | cancel_time_dict={} |
| | | cancel_time_dict = {} |
| | | for index in watch_indexes: |
| | | if index > real_place_order_index: |
| | | continue |
| | | orderNo = str(total_datas[index]["val"]["orderNo"]) |
| | | if orderNo not in canceled_buyno_map: |
| | | continue |
| | | if tool.trade_time_sub(total_datas[-1]["val"]["time"], canceled_buyno_map[orderNo]["val"]["time"]) < 10 * 60: |
| | | if tool.trade_time_sub(total_datas[-1]["val"]["time"], |
| | | canceled_buyno_map[orderNo]["val"]["time"]) < 10 * 60: |
| | | continue |
| | | val = total_datas[index]["val"] |
| | | time_str = L2DataUtil.get_time_with_ms(val) |
| | |
| | | cancel_time_dict[time_str] = set() |
| | | cancel_time_dict[time_str].add(index) |
| | | remove_indexes = set() |
| | | for t in cancel_time_dict: |
| | | if len(cancel_time_dict[t])>1: |
| | | remove_indexes|=cancel_time_dict[t] |
| | | for t in cancel_time_dict: |
| | | if len(cancel_time_dict[t]) > 1: |
| | | remove_indexes |= cancel_time_dict[t] |
| | | if remove_indexes: |
| | | # 移除索引 |
| | | add_count = len(remove_indexes) |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | min_num = int(5000/limit_up_price) |
| | | min_num = int(5000 / limit_up_price) |
| | | trade_index, is_default = TradeBuyQueue().get_traded_index(code) |
| | | if trade_index is None: |
| | | trade_index = 0 |
| | | add_watch_index = self.compute_l_down_common_watch_indexes(code,trade_index ,real_place_order_index, add_count, min_num, watch_indexes) |
| | | add_watch_index = self.compute_l_down_common_watch_indexes(code, trade_index, real_place_order_index, |
| | | add_count, min_num, watch_indexes) |
| | | watch_indexes -= remove_indexes |
| | | watch_indexes|=add_watch_index |
| | | watch_indexes |= add_watch_index |
| | | # 保存数据 / |
| | | LCancelBigNumComputer().set_l_down_watch_index_info(code, watch_indexes_info[0], True, watch_indexes) |
| | | l2_log.l_cancel_debug(code, f"L后稳定后更新监控范围:删除-{remove_indexes} 增加-{add_watch_index}") |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | # --------------------------------H撤------------------------------- |