| | |
| | | |
| | | from utils import tool |
| | | from l2.transaction_progress import TradeBuyQueue |
| | | from trade import l2_trade_factor, trade_record_log_util |
| | | from trade import l2_trade_factor, trade_record_log_util, trade_constant |
| | | from l2 import l2_log, l2_data_source_util |
| | | from l2.l2_data_util import L2DataUtil, local_today_datas, local_today_canceled_buyno_map, local_today_buyno_map |
| | | from log_module.log import logger_l2_s_cancel, logger_debug, logger_l2_l_cancel, logger_l2_h_cancel |
| | |
| | | |
| | | def need_cancel(self, code, buy_exec_index, start_index, end_index, total_data, is_first_code): |
| | | if buy_exec_index is None: |
| | | return False, None, "尚未找到下单位置" |
| | | return False, None, "尚未找到下单位置", None |
| | | # 守护S撤以外的数据 |
| | | if int(tool.get_now_time_str().replace(":", "")) > int("145700") and not constant.TEST: |
| | | return False, None, "" |
| | | return False, None, "", 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 |
| | | can_cancel, cancel_data, cancel_type = False, None, None |
| | | try: |
| | | can_cancel, cancel_data = self.__compute_need_cancel(code, buy_exec_index, start_index, end_index, |
| | | total_data, |
| | | is_first_code) |
| | | if can_cancel: |
| | | cancel_type = trade_constant.CANCEL_TYPE_L_DOWN |
| | | except Exception as e: |
| | | logger_l2_l_cancel.exception(e) |
| | | raise e |
| | |
| | | start_index, end_index, |
| | | total_data, |
| | | is_first_code) |
| | | if can_cancel: |
| | | cancel_type = trade_constant.CANCEL_TYPE_L_UP |
| | | extra_msg = "L前" |
| | | except Exception as e: |
| | | logger_l2_l_cancel.exception(e) |
| | |
| | | except Exception as e: |
| | | l2_log.l_cancel_debug(code, "L后后半段计算出错:{}", str(e)) |
| | | |
| | | return can_cancel, cancel_data, extra_msg |
| | | return can_cancel, cancel_data, extra_msg, cancel_type |
| | | |
| | | def place_order_success(self, code): |
| | | self.clear(code) |