Skip to content

Commit

Permalink
[Add] 过滤不支持类型的委托
Browse files Browse the repository at this point in the history
  • Loading branch information
vnpy committed Aug 15, 2021
1 parent a6272cc commit 8c54c36
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vnpy_binance/binance_spot_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ def on_query_account(self, data: dict, request: Request) -> None:
def on_query_order(self, data: dict, request: Request) -> None:
"""未成交委托查询回报"""
for d in data:
# 过滤不支持类型的委托
if d["type"] not in ORDERTYPE_BINANCE2VT:
continue

order: OrderData = OrderData(
orderid=d["clientOrderId"],
symbol=d["symbol"].lower(),
Expand Down Expand Up @@ -698,6 +702,10 @@ def on_account(self, packet: dict) -> None:

def on_order(self, packet: dict) -> None:
"""委托更新推送"""
# 过滤不支持类型的委托
if packet["o"] not in ORDERTYPE_BINANCE2VT:
return

if packet["C"] == "":
orderid: str = packet["c"]
else:
Expand Down

0 comments on commit 8c54c36

Please sign in to comment.