| | |
| | | # 保存成交位置到执行位置的揽括范围数据 |
| | | def __save_watch_index_set(self, code, indexes): |
| | | trade_record_log_util.add_cancel_watch_indexes_log(code, |
| | | CancelWatchIndexesInfo(CancelWatchIndexesInfo.CANCEL_TYPE_H, |
| | | list(indexes))) |
| | | trade_record_log_util.CancelWatchIndexesInfo( |
| | | trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_H, |
| | | list(indexes))) |
| | | CodeDataCacheUtil.set_cache(self.__cancel_watch_indexs_cache, code, indexes) |
| | | key = f"h_cancel_watch_indexs-{code}" |
| | | RedisUtils.setex_async(self.__db, key, tool.get_expire(), |
| | |
| | | def __add_watch_indexes(self, code, indexes): |
| | | if not indexes: |
| | | return |
| | | trade_record_log_util.add_cancel_watch_indexes_log(code, |
| | | trade_record_log_util.CancelWatchIndexesInfo(trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_L_DOWN, |
| | | list(indexes))) |
| | | |
| | | if code not in self.__cancel_watch_index_cache: |
| | | self.__cancel_watch_index_cache[code] = set() |
| | | for index in indexes: |
| | |
| | | RedisUtils.delete_async(self.__db, f"l_cancel_watch_index-{code}") |
| | | for index in indexes: |
| | | RedisUtils.srem_async(self.__db, f"l_cancel_watch_index-{code}", index) |
| | | if indexes: |
| | | trade_record_log_util.add_cancel_watch_indexes_log(code, |
| | | trade_record_log_util.CancelWatchIndexesInfo( |
| | | trade_record_log_util.CancelWatchIndexesInfo.CANCEL_TYPE_L_DOWN, |
| | | list(indexes))) |
| | | |
| | | def __get_watch_indexes(self, code): |
| | | return RedisUtils.smembers(self.__get_redis(), f"l_cancel_watch_index-{code}") |
| | |
| | | # 下单位临近撤 |
| | | can_cancel, cancel_data = False, None |
| | | try: |
| | | can_cancel, cancel_data = self.__compute_need_cancel(code, buy_exec_index, start_index, end_index, total_data, |
| | | can_cancel, cancel_data = self.__compute_need_cancel(code, buy_exec_index, start_index, end_index, |
| | | total_data, |
| | | is_first_code) |
| | | except Exception as e: |
| | | logger_l2_l_cancel.exception(e) |