[Mod]change ctp orderid format
This commit is contained in:
parent
90682ab92d
commit
cd716b4da8
@ -139,9 +139,7 @@ class PositionHolding:
|
|||||||
|
|
||||||
def update_order_request(self, req: OrderRequest, vt_orderid: str):
|
def update_order_request(self, req: OrderRequest, vt_orderid: str):
|
||||||
""""""
|
""""""
|
||||||
ix = vt_orderid.index(".")
|
gateway_name, orderid = vt_orderid.split(".")
|
||||||
gateway_name = vt_orderid[:ix]
|
|
||||||
orderid = vt_orderid[ix + 1:]
|
|
||||||
|
|
||||||
order = req.create_order_data(orderid, gateway_name)
|
order = req.create_order_data(orderid, gateway_name)
|
||||||
self.update_order(order)
|
self.update_order(order)
|
||||||
|
@ -433,7 +433,7 @@ class CtpTdApi(TdApi):
|
|||||||
def onRspOrderInsert(self, data: dict, error: dict, reqid: int, last: bool):
|
def onRspOrderInsert(self, data: dict, error: dict, reqid: int, last: bool):
|
||||||
""""""
|
""""""
|
||||||
order_ref = data["OrderRef"]
|
order_ref = data["OrderRef"]
|
||||||
orderid = f"{self.frontid}.{self.sessionid}.{order_ref}"
|
orderid = f"{self.frontid}-{self.sessionid}-{order_ref}"
|
||||||
|
|
||||||
symbol = data["InstrumentID"]
|
symbol = data["InstrumentID"]
|
||||||
exchange = symbol_exchange_map[symbol]
|
exchange = symbol_exchange_map[symbol]
|
||||||
@ -586,7 +586,7 @@ class CtpTdApi(TdApi):
|
|||||||
frontid = data["FrontID"]
|
frontid = data["FrontID"]
|
||||||
sessionid = data["SessionID"]
|
sessionid = data["SessionID"]
|
||||||
order_ref = data["OrderRef"]
|
order_ref = data["OrderRef"]
|
||||||
orderid = f"{frontid}.{sessionid}.{order_ref}"
|
orderid = f"{frontid}-{sessionid}-{order_ref}"
|
||||||
|
|
||||||
order = OrderData(
|
order = OrderData(
|
||||||
symbol=symbol,
|
symbol=symbol,
|
||||||
@ -722,7 +722,7 @@ class CtpTdApi(TdApi):
|
|||||||
self.reqid += 1
|
self.reqid += 1
|
||||||
self.reqOrderInsert(ctp_req, self.reqid)
|
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)
|
order = req.create_order_data(orderid, self.gateway_name)
|
||||||
self.gateway.on_order(order)
|
self.gateway.on_order(order)
|
||||||
|
|
||||||
@ -732,7 +732,7 @@ class CtpTdApi(TdApi):
|
|||||||
"""
|
"""
|
||||||
Cancel existing order.
|
Cancel existing order.
|
||||||
"""
|
"""
|
||||||
frontid, sessionid, order_ref = req.orderid.split(".")
|
frontid, sessionid, order_ref = req.orderid.split("-")
|
||||||
|
|
||||||
ctp_req = {
|
ctp_req = {
|
||||||
"InstrumentID": req.symbol,
|
"InstrumentID": req.symbol,
|
||||||
|
Loading…
Reference in New Issue
Block a user