| | |
| | | # 处理买单 |
| | | @classmethod |
| | | def process_buy_order(cls, order: HuaxinOrderEntity): |
| | | """ |
| | | 处理买单 |
| | | @param order: |
| | | @return: 是否需要撤单 |
| | | """ |
| | | |
| | | # 处理下单成功 |
| | | def process_order_success(order_: HuaxinOrderEntity, delay_s=0.0): |
| | | if delay_s > 0: |
| | |
| | | |
| | | # 只处理买入单 |
| | | if order.direction != str(huaxin_util.TORA_TSTP_D_Buy): |
| | | return |
| | | return False |
| | | |
| | | # 只处理正式订单,不处理影子订单 |
| | | if order.is_shadow_order: |
| | | return |
| | | # 9:15之前下的影子单 |
| | | if order.insertTime and int(order.insertTime.replace(":", "")) < int("091500"): |
| | | # 是委托状态的影子单且是交易所已接受的状态 |
| | | if order.orderStatus == huaxin_util.TORA_TSTP_OST_Accepted: |
| | | # 需要撤单 |
| | | return True |
| | | return False |
| | | |
| | | # 同一订单号只有状态变化了才需要处理 |
| | | key = f"{order.insertDate}_{order.code}_{order.orderSysID}_{order.orderStatus}" |
| | | if key in cls.__processed_keys: |
| | | return |
| | | return False |
| | | try: |
| | | async_log_util.info(hx_logger_trade_debug, f"处理华鑫订单:{key}") |
| | | cls.__processed_keys.add(key) |
| | |
| | | CancelOrderManager().cancel_success(order.code, order.orderRef, order.orderSysID) |
| | | except Exception as e: |
| | | async_log_util.exception(hx_logger_trade_debug, e) |
| | | return False |
| | | |
| | | # 返回是否要监控撤单 |
| | | @classmethod |