diff --git a/vnpy/gateway/ctp/ctp_gateway.py b/vnpy/gateway/ctp/ctp_gateway.py index 43f796b2..3361a053 100644 --- a/vnpy/gateway/ctp/ctp_gateway.py +++ b/vnpy/gateway/ctp/ctp_gateway.py @@ -84,6 +84,7 @@ ORDERTYPE_VT2CTP = { OrderType.LIMIT: THOST_FTDC_OPT_LimitPrice, OrderType.MARKET: THOST_FTDC_OPT_AnyPrice } +ORDERTYPE_CTP2VT = {v: k for k, v in ORDERTYPE_VT2CTP.items()} OFFSET_VT2CTP = { Offset.OPEN: THOST_FTDC_OF_Open, @@ -591,6 +592,7 @@ class CtpTdApi(TdApi): symbol=symbol, exchange=exchange, orderid=orderid, + type=ORDERTYPE_CTP2VT[data["OrderPriceType"]], direction=DIRECTION_CTP2VT[data["Direction"]], offset=OFFSET_CTP2VT[data["CombOffsetFlag"]], price=data["LimitPrice"], diff --git a/vnpy/gateway/ib/ib_gateway.py b/vnpy/gateway/ib/ib_gateway.py index fbe70096..856d2abf 100644 --- a/vnpy/gateway/ib/ib_gateway.py +++ b/vnpy/gateway/ib/ib_gateway.py @@ -349,6 +349,7 @@ class IbApi(EWrapper): symbol=ib_contract.conId, exchange=EXCHANGE_IB2VT.get( ib_contract.exchange, ib_contract.exchange), + type=ORDERTYPE_IB2VT[ib_order.orderType], orderid=orderid, direction=DIRECTION_IB2VT[ib_order.action], price=ib_order.lmtPrice, diff --git a/vnpy/trader/object.py b/vnpy/trader/object.py index ccbe9b82..0c65f95f 100644 --- a/vnpy/trader/object.py +++ b/vnpy/trader/object.py @@ -108,6 +108,7 @@ class OrderData(BaseData): exchange: Exchange orderid: str + type: OrderType = OrderType.LIMIT direction: Direction = "" offset: Offset = Offset.NONE price: float = 0 @@ -282,6 +283,7 @@ class OrderRequest: symbol=self.symbol, exchange=self.exchange, orderid=orderid, + type=self.type, direction=self.direction, offset=self.offset, price=self.price, diff --git a/vnpy/trader/ui/widget.py b/vnpy/trader/ui/widget.py index 66a05733..e40da3c1 100644 --- a/vnpy/trader/ui/widget.py +++ b/vnpy/trader/ui/widget.py @@ -411,6 +411,7 @@ class OrderMonitor(BaseMonitor): "orderid": {"display": "委托号", "cell": BaseCell, "update": False}, "symbol": {"display": "代码", "cell": BaseCell, "update": False}, "exchange": {"display": "交易所", "cell": EnumCell, "update": False}, + "type": {"display": "类型", "cell": EnumCell, "update": False}, "direction": {"display": "方向", "cell": DirectionCell, "update": False}, "offset": {"display": "开平", "cell": EnumCell, "update": False}, "price": {"display": "价格", "cell": BaseCell, "update": False},