diff --git a/vnpy/app/cta_strategy/converter.py b/vnpy/app/cta_strategy/converter.py index 153b7097..a7f5a1b1 100644 --- a/vnpy/app/cta_strategy/converter.py +++ b/vnpy/app/cta_strategy/converter.py @@ -139,9 +139,7 @@ class PositionHolding: def update_order_request(self, req: OrderRequest, vt_orderid: str): """""" - ix = vt_orderid.index(".") - gateway_name = vt_orderid[:ix] - orderid = vt_orderid[ix + 1:] + gateway_name, orderid = vt_orderid.split(".") order = req.create_order_data(orderid, gateway_name) self.update_order(order) diff --git a/vnpy/gateway/ctp/ctp_gateway.py b/vnpy/gateway/ctp/ctp_gateway.py index 885da743..68b3baae 100644 --- a/vnpy/gateway/ctp/ctp_gateway.py +++ b/vnpy/gateway/ctp/ctp_gateway.py @@ -433,7 +433,7 @@ class CtpTdApi(TdApi): def onRspOrderInsert(self, data: dict, error: dict, reqid: int, last: bool): """""" order_ref = data["OrderRef"] - orderid = f"{self.frontid}.{self.sessionid}.{order_ref}" + orderid = f"{self.frontid}-{self.sessionid}-{order_ref}" symbol = data["InstrumentID"] exchange = symbol_exchange_map[symbol] @@ -586,7 +586,7 @@ class CtpTdApi(TdApi): frontid = data["FrontID"] sessionid = data["SessionID"] order_ref = data["OrderRef"] - orderid = f"{frontid}.{sessionid}.{order_ref}" + orderid = f"{frontid}-{sessionid}-{order_ref}" order = OrderData( symbol=symbol, @@ -722,7 +722,7 @@ class CtpTdApi(TdApi): self.reqid += 1 self.reqOrderInsert(ctp_req, self.reqid) - orderid = f"{self.frontid}.{self.sessionid}.{self.order_ref}" + orderid = f"{self.frontid}-{self.sessionid}-{self.order_ref}" order = req.create_order_data(orderid, self.gateway_name) self.gateway.on_order(order) @@ -732,7 +732,7 @@ class CtpTdApi(TdApi): """ Cancel existing order. """ - frontid, sessionid, order_ref = req.orderid.split(".") + frontid, sessionid, order_ref = req.orderid.split("-") ctp_req = { "InstrumentID": req.symbol,