| | |
| | | def l_cancel(_buy_single_index, _buy_exec_index): |
| | | _start_time = round(t.time() * 1000) |
| | | try: |
| | | b_need_cancel, b_cancel_data, extra_msg = cls.__LCancelBigNumComputer.need_cancel(code, |
| | | _buy_exec_index, |
| | | start_index, |
| | | end_index, total_data, |
| | | is_first_code) |
| | | b_need_cancel, b_cancel_data, extra_msg, b_cancel_type = cls.__LCancelBigNumComputer.need_cancel(code, |
| | | _buy_exec_index, |
| | | start_index, |
| | | end_index, |
| | | total_data, |
| | | is_first_code) |
| | | if b_need_cancel and b_cancel_data: |
| | | return b_cancel_data, f"L撤({extra_msg})" |
| | | return b_cancel_data, f"L撤({extra_msg})", b_cancel_type |
| | | except Exception as e: |
| | | async_log_util.error(logger_l2_error, |
| | | f"L撤出错 参数:buy_single_index-{_buy_single_index} buy_exec_index-{_buy_exec_index} 错误原因:{str(e)}") |
| | |
| | | finally: |
| | | # l2_data_log.l2_time(code, round(t.time() * 1000) - _start_time, "已下单-L撤大单计算") |
| | | pass |
| | | return None, "" |
| | | return None, "", None |
| | | |
| | | # G撤 |
| | | def g_cancel(_buy_single_index, _buy_exec_index): |
| | |
| | | cancel_type = trade_constant.CANCEL_TYPE_G |
| | | # 依次处理 |
| | | if not cancel_data: |
| | | cancel_data, cancel_msg = l_cancel(order_begin_pos.buy_single_index, order_begin_pos.buy_exec_index) |
| | | cancel_type = trade_constant.CANCEL_TYPE_L |
| | | cancel_data, cancel_msg, cancel_type = l_cancel(order_begin_pos.buy_single_index, |
| | | order_begin_pos.buy_exec_index) |
| | | # B撤 |
| | | if not cancel_data: |
| | | cancel_data, cancel_msg = b_cancel(order_begin_pos.buy_single_index, order_begin_pos.buy_exec_index) |
| | |
| | | if cancel_type != trade_constant.CANCEL_TYPE_HUMAN: |
| | | # 是否是交易队列触发 |
| | | # 扫入下单只有L撤能撤单 |
| | | if order_begin_pos and order_begin_pos.mode == OrderBeginPosInfo.MODE_RADICAL and cancel_type not in {trade_constant.CANCEL_TYPE_L_DOWN}: |
| | | if order_begin_pos and order_begin_pos.mode == OrderBeginPosInfo.MODE_RADICAL and cancel_type not in { |
| | | trade_constant.CANCEL_TYPE_L_DOWN, trade_constant.CANCEL_TYPE_L}: |
| | | l2_log.cancel_debug(code, "撤单中断,原因:{}", "扫入下单不是L撤") |
| | | return False |
| | | # 加绿只有L撤/人撤生效 |