[Add] filter for empty query trade/order data
This commit is contained in:
parent
5e31db27b2
commit
238b59f112
@ -454,26 +454,27 @@ class DaFutureApi(FutureApi):
|
|||||||
"""
|
"""
|
||||||
Callback of order query.
|
Callback of order query.
|
||||||
"""
|
"""
|
||||||
order = OrderData(
|
if data["TreatyCode"]:
|
||||||
symbol=data["TreatyCode"],
|
order = OrderData(
|
||||||
exchange=EXCHANGE_DA2VT[data["ExchangeCode"]],
|
symbol=data["TreatyCode"],
|
||||||
orderid=data["LocalNo"],
|
exchange=EXCHANGE_DA2VT[data["ExchangeCode"]],
|
||||||
type=ORDERTYPE_DA2VT[data["PriceType"]],
|
orderid=data["LocalNo"],
|
||||||
direction=DIRECTION_DA2VT[data["BuySale"]],
|
type=ORDERTYPE_DA2VT[data["PriceType"]],
|
||||||
offset=OFFSET_DA2VT[data["AddReduce"]],
|
direction=DIRECTION_DA2VT[data["BuySale"]],
|
||||||
price=float(data["OrderPrice"]),
|
offset=OFFSET_DA2VT[data["AddReduce"]],
|
||||||
volume=int(data["OrderNumber"]),
|
price=float(data["OrderPrice"]),
|
||||||
traded=int(data["FilledNumber"]),
|
volume=int(data["OrderNumber"]),
|
||||||
status=STATUS_DA2VT[data["OrderState"]],
|
traded=int(data["FilledNumber"]),
|
||||||
time=data["OrderTime"],
|
status=STATUS_DA2VT[data["OrderState"]],
|
||||||
gateway_name=self.gateway_name
|
time=data["OrderTime"],
|
||||||
)
|
gateway_name=self.gateway_name
|
||||||
|
)
|
||||||
|
|
||||||
self.local_no = max(self.local_no, int(data["LocalNo"]))
|
self.local_no = max(self.local_no, int(data["LocalNo"]))
|
||||||
self.orders[order.orderid] = order
|
self.orders[order.orderid] = order
|
||||||
self.order_info[order.orderid] = (data["OrderNo"], data["SystemNo"])
|
self.order_info[order.orderid] = (data["OrderNo"], data["SystemNo"])
|
||||||
|
|
||||||
self.gateway.on_order(copy(order))
|
self.gateway.on_order(copy(order))
|
||||||
|
|
||||||
if last:
|
if last:
|
||||||
self.gateway.write_log("委托信息查询成功")
|
self.gateway.write_log("委托信息查询成功")
|
||||||
@ -482,7 +483,8 @@ class DaFutureApi(FutureApi):
|
|||||||
"""
|
"""
|
||||||
Callback of trade query.
|
Callback of trade query.
|
||||||
"""
|
"""
|
||||||
self.update_trade(data)
|
if data["TreatyCode"]:
|
||||||
|
self.update_trade(data)
|
||||||
|
|
||||||
if last:
|
if last:
|
||||||
self.gateway.write_log("成交信息查询成功")
|
self.gateway.write_log("成交信息查询成功")
|
||||||
|
Loading…
Reference in New Issue
Block a user