Skip to content

Commit

Permalink
Update ib_gateway.py
Browse files Browse the repository at this point in the history
  • Loading branch information
noranhe committed Apr 30, 2021
1 parent f3f2563 commit 34d7117
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vnpy/gateway/ib/ib_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ def __init__(self, gateway: BaseGateway):
self.reqid = 0
self.orderid = 0
self.clientid = 0
self.history_reqid = 0
self.account = ""
self.ticks = {}
self.orders = {}
Expand Down Expand Up @@ -313,6 +314,10 @@ def error(self, reqId: TickerId, errorCode: int, errorString: str): # pylint: d
Callback of error caused by specific request.
"""
super().error(reqId, errorCode, errorString)
if reqId == self.history_reqid:
self.history_condition.acquire()
self.history_condition.notify()
self.history_condition.release()

msg = f"信息通知,代码:{errorCode},内容: {errorString}"
self.gateway.write_log(msg)
Expand Down Expand Up @@ -806,6 +811,7 @@ def query_history(self, req: HistoryRequest):
else:
bar_type = "TRADES"

self.history_reqid = self.reqid
self.client.reqHistoricalData(
self.reqid,
ib_contract,
Expand Down

0 comments on commit 34d7117

Please sign in to comment.