| | |
| | | |
| | | __SecondCancelBigNumComputer = SecondCancelBigNumComputer() |
| | | |
| | | __last_l_up_compute_info = {} |
| | | |
| | | __instance = None |
| | | |
| | | def __new__(cls, *args, **kwargs): |
| | |
| | | else: |
| | | self.__compute_trade_progress_near_by_indexes(code, buy_single_index, index) |
| | | |
| | | # 重新计算L上 |
| | | def re_compute_l_up_watch_indexes(self, code): |
| | | if code not in self.__last_trade_progress_dict: |
| | | return |
| | | if code not in self.__real_place_order_index_dict: |
| | | return |
| | | if code not in self.__last_l_up_compute_info or time.time() - self.__last_l_up_compute_info[code][0] >= 3: |
| | | self.__compute_trade_progress_near_by_indexes(code, self.__last_trade_progress_dict.get(code) + 1, |
| | | self.__real_place_order_index_dict.get(code)) |
| | | |
| | | # 计算范围内的成交位临近未撤大单 |
| | | def __compute_trade_progress_near_by_indexes(self, code, start_index, end_index): |
| | | if start_index is None or end_index is None: |
| | |
| | | watch_indexes.add(i) |
| | | if len(watch_indexes) >= MAX_COUNT: |
| | | break |
| | | |
| | | changed = True |
| | | if code in self.__last_l_up_compute_info: |
| | | if self.__last_l_up_compute_info[code] == watch_indexes: |
| | | changed = False |
| | | # 保存数据 |
| | | l2_log.l_cancel_debug(code, f"设置成交位临近撤单监控范围:{watch_indexes} 计算范围:{start_index}-{end_index}") |
| | | self.__set_near_by_trade_progress_indexes(code, watch_indexes) |
| | | if changed: |
| | | l2_log.l_cancel_debug(code, f"设置成交位临近撤单监控范围:{watch_indexes} 计算范围:{start_index}-{end_index}") |
| | | self.__set_near_by_trade_progress_indexes(code, watch_indexes) |
| | | self.__last_l_up_compute_info[code] = (time.time(), watch_indexes) |
| | | |
| | | # 设置成交位置,成交位置变化之后相应的监听数据也会发生变化 |
| | | def set_trade_progress(self, code, index, total_datas): |