Administrator
2023-11-30 c3c7a844293f595e6522e28b348edfb4db551721
bug修改/撤单包含撤卖单
2个文件已修改
23 ■■■■ 已修改文件
trade/huaxin/huaxin_trade_order_processor.py 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_server.py 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_order_processor.py
@@ -182,6 +182,15 @@
        return cls.order_ref_dict.get(order_ref)
    @classmethod
    def get_huaxin_sell_order_by_code(cls, code):
        results = []
        for k in cls.order_ref_dict:
            entity = cls.order_ref_dict[k]
            if entity.code == code and entity.direction == huaxin_util.TORA_TSTP_D_Sell:
                results.append(entity)
        return results
    @classmethod
    def order_success(cls, order: HuaxinOrderEntity):
        async_log_util.info(hx_logger_trade_debug, f"处理华鑫订单下单成功:{order.code}, {order.orderRef}, {order.orderSysID}")
        # 加入系统订单号
trade/huaxin/huaxin_trade_server.py
@@ -601,6 +601,14 @@
                                                           blocking=True, request_id=request_id)
                    self.send_response({"code": 0, "data": result}, client_id, request_id)
                elif code:
                    try:
                        sell_orders = huaxin_trade_order_processor.TradeResultProcessor.get_huaxin_sell_order_by_code(code)
                        if sell_orders:
                            for sell_order in sell_orders:
                                if huaxin_util.is_can_cancel(sell_order.orderStatus):
                                    huaxin_trade_api.cancel_order(direction, code, sell_order.orderRef, blocking=False)
                    except Exception as e:
                        logger_debug.exception(e)
                    l2_data_manager_new.L2TradeDataProcessor.cancel_buy(code, "手动撤单")
                    self.send_response({"code": 0, "data": {"code": 0}}, client_id, request_id)
@@ -1023,7 +1031,7 @@
                        # 判断是否有名称
                        results = HistoryKDatasUtils.get_gp_codes_names([d["securityID"]])
                        threading.Thread(
                            target=CodesNameManager.add_first_code_name(d["securityID"], results[0])).start()
                            target=CodesNameManager.add_first_code_name(d["securityID"], results[d["securityID"]])).start()
                    if d["prePosition"] <= 0:
                        continue
                    if d["securityID"] != code:
@@ -1033,11 +1041,9 @@
                    break
            result = {"code": 0, "data": fdata}
            self.send_response(result, client_id, request_id)
        except Exception as e:
            logging.exception(e)
            self.send_response(json.dumps({"code": 1, "msg": f"数据处理出错:{e}"}), client_id, request_id)
            self.send_response({"code": 1, "msg": f"数据处理出错:{e}"}, client_id, request_id)
    def OnCommonRequest(self, client_id, request_id, data):
        # 通用请求