Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Move clearing of domBids and domAsks from cancelMktDepth to reqMktDep…
Browse files Browse the repository at this point in the history
…th, fixes #665
  • Loading branch information
erdewit committed Dec 1, 2023
1 parent d31241f commit 46976b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ib_insync/ib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,8 @@ def reqMktDepth(
"""
reqId = self.client.getReqId()
ticker = self.wrapper.startTicker(reqId, contract, 'mktDepth')
ticker.domBids.clear()
ticker.domAsks.clear()
self.client.reqMktDepth(
reqId, contract, numRows, isSmartDepth, mktDepthOptions)
return ticker
Expand All @@ -1349,8 +1351,6 @@ def cancelMktDepth(self, contract: Contract, isSmartDepth=False):
reqId = self.wrapper.endTicker(ticker, 'mktDepth') if ticker else 0
if ticker and reqId:
self.client.cancelMktDepth(reqId, isSmartDepth)
ticker.domBids.clear()
ticker.domAsks.clear()
else:
self._logger.error(
f'cancelMktDepth: No reqId found for contract {contract}')
Expand Down

0 comments on commit 46976b2

Please sign in to comment.