| | |
| | | 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}") |
| | | # 加入系统订单号 |
| | |
| | | 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) |
| | | |
| | |
| | | # 判断是否有名称 |
| | | 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: |
| | |
| | | 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): |
| | | # 通用请求 |