[Mod] use auxPrice for IB stop order, close #2100

This commit is contained in:
vn.py 2019-11-07 16:05:22 +08:00
parent 11d94b9902
commit b53a286295

View File

@ -392,11 +392,15 @@ class IbApi(EWrapper):
type=ORDERTYPE_IB2VT[ib_order.orderType], 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,
volume=ib_order.totalQuantity, volume=ib_order.totalQuantity,
gateway_name=self.gateway_name, gateway_name=self.gateway_name,
) )
if order.type == OrderType.LIMIT:
order.price = ib_order.lmtPrice
elif order.type == OrderType.STOP:
order.price = ib_order.auxPrice
self.orders[orderid] = order self.orders[orderid] = order
self.gateway.on_order(copy(order)) self.gateway.on_order(copy(order))