[Mod] filter close position order data from web ui

This commit is contained in:
vn.py 2019-11-07 14:27:33 +08:00
parent a67f32ae23
commit 998045b7c8

View File

@ -703,9 +703,15 @@ class BitmexWebsocketApi(WebsocketClient):
def on_order(self, d): def on_order(self, d):
"""""" """"""
# Filter order data which cannot be processed properly
if "ordStatus" not in d: if "ordStatus" not in d:
return return
side = d.get("side", "")
if not side:
return
# Update local order data
sysid = d["orderID"] sysid = d["orderID"]
order = self.orders.get(sysid, None) order = self.orders.get(sysid, None)
if not order: if not order:
@ -714,14 +720,12 @@ class BitmexWebsocketApi(WebsocketClient):
else: else:
orderid = sysid orderid = sysid
# time = d["timestamp"][11:19]
order = OrderData( order = OrderData(
symbol=d["symbol"], symbol=d["symbol"],
exchange=Exchange.BITMEX, exchange=Exchange.BITMEX,
type=ORDERTYPE_BITMEX2VT[d["ordType"]], type=ORDERTYPE_BITMEX2VT[d["ordType"]],
orderid=orderid, orderid=orderid,
direction=DIRECTION_BITMEX2VT[d["side"]], direction=DIRECTION_BITMEX2VT[side],
price=d["price"], price=d["price"],
volume=d["orderQty"], volume=d["orderQty"],
time=d["timestamp"][11:19], time=d["timestamp"][11:19],