[Add]OrderData object support order type data (ctp/ib)
This commit is contained in:
parent
38f00a24ed
commit
9e91df57d4
@ -84,6 +84,7 @@ ORDERTYPE_VT2CTP = {
|
|||||||
OrderType.LIMIT: THOST_FTDC_OPT_LimitPrice,
|
OrderType.LIMIT: THOST_FTDC_OPT_LimitPrice,
|
||||||
OrderType.MARKET: THOST_FTDC_OPT_AnyPrice
|
OrderType.MARKET: THOST_FTDC_OPT_AnyPrice
|
||||||
}
|
}
|
||||||
|
ORDERTYPE_CTP2VT = {v: k for k, v in ORDERTYPE_VT2CTP.items()}
|
||||||
|
|
||||||
OFFSET_VT2CTP = {
|
OFFSET_VT2CTP = {
|
||||||
Offset.OPEN: THOST_FTDC_OF_Open,
|
Offset.OPEN: THOST_FTDC_OF_Open,
|
||||||
@ -591,6 +592,7 @@ class CtpTdApi(TdApi):
|
|||||||
symbol=symbol,
|
symbol=symbol,
|
||||||
exchange=exchange,
|
exchange=exchange,
|
||||||
orderid=orderid,
|
orderid=orderid,
|
||||||
|
type=ORDERTYPE_CTP2VT[data["OrderPriceType"]],
|
||||||
direction=DIRECTION_CTP2VT[data["Direction"]],
|
direction=DIRECTION_CTP2VT[data["Direction"]],
|
||||||
offset=OFFSET_CTP2VT[data["CombOffsetFlag"]],
|
offset=OFFSET_CTP2VT[data["CombOffsetFlag"]],
|
||||||
price=data["LimitPrice"],
|
price=data["LimitPrice"],
|
||||||
|
@ -349,6 +349,7 @@ class IbApi(EWrapper):
|
|||||||
symbol=ib_contract.conId,
|
symbol=ib_contract.conId,
|
||||||
exchange=EXCHANGE_IB2VT.get(
|
exchange=EXCHANGE_IB2VT.get(
|
||||||
ib_contract.exchange, ib_contract.exchange),
|
ib_contract.exchange, ib_contract.exchange),
|
||||||
|
type=ORDERTYPE_IB2VT[ib_order.orderType],
|
||||||
orderid=orderid,
|
orderid=orderid,
|
||||||
direction=DIRECTION_IB2VT[ib_order.action],
|
direction=DIRECTION_IB2VT[ib_order.action],
|
||||||
price=ib_order.lmtPrice,
|
price=ib_order.lmtPrice,
|
||||||
|
@ -108,6 +108,7 @@ class OrderData(BaseData):
|
|||||||
exchange: Exchange
|
exchange: Exchange
|
||||||
orderid: str
|
orderid: str
|
||||||
|
|
||||||
|
type: OrderType = OrderType.LIMIT
|
||||||
direction: Direction = ""
|
direction: Direction = ""
|
||||||
offset: Offset = Offset.NONE
|
offset: Offset = Offset.NONE
|
||||||
price: float = 0
|
price: float = 0
|
||||||
@ -282,6 +283,7 @@ class OrderRequest:
|
|||||||
symbol=self.symbol,
|
symbol=self.symbol,
|
||||||
exchange=self.exchange,
|
exchange=self.exchange,
|
||||||
orderid=orderid,
|
orderid=orderid,
|
||||||
|
type=self.type,
|
||||||
direction=self.direction,
|
direction=self.direction,
|
||||||
offset=self.offset,
|
offset=self.offset,
|
||||||
price=self.price,
|
price=self.price,
|
||||||
|
@ -411,6 +411,7 @@ class OrderMonitor(BaseMonitor):
|
|||||||
"orderid": {"display": "委托号", "cell": BaseCell, "update": False},
|
"orderid": {"display": "委托号", "cell": BaseCell, "update": False},
|
||||||
"symbol": {"display": "代码", "cell": BaseCell, "update": False},
|
"symbol": {"display": "代码", "cell": BaseCell, "update": False},
|
||||||
"exchange": {"display": "交易所", "cell": EnumCell, "update": False},
|
"exchange": {"display": "交易所", "cell": EnumCell, "update": False},
|
||||||
|
"type": {"display": "类型", "cell": EnumCell, "update": False},
|
||||||
"direction": {"display": "方向", "cell": DirectionCell, "update": False},
|
"direction": {"display": "方向", "cell": DirectionCell, "update": False},
|
||||||
"offset": {"display": "开平", "cell": EnumCell, "update": False},
|
"offset": {"display": "开平", "cell": EnumCell, "update": False},
|
||||||
"price": {"display": "价格", "cell": BaseCell, "update": False},
|
"price": {"display": "价格", "cell": BaseCell, "update": False},
|
||||||
|
Loading…
Reference in New Issue
Block a user