Skip to content

Commit e01010c

Browse files
authored
Fix order cancellation bug introduced by IB API change and fix order id deadlock (#98)
* Fixes #97 * Fix based on testing. * Change order id strategy to increment to avoid deadlocks. Fix #99
1 parent b5c547f commit e01010c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/deephaven_ib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ class IbSessionTws:
426426
_tables_raw: Dict[str, Table]
427427
_tables: Dict[str, Table]
428428

429-
def __init__(self, host: str = "", port: int = 7497, client_id: int = 0, download_short_rates: bool = True, order_id_strategy: OrderIdStrategy = OrderIdStrategy.RETRY, read_only: bool = True, is_fa: bool = False):
429+
def __init__(self, host: str = "", port: int = 7497, client_id: int = 0, download_short_rates: bool = True, order_id_strategy: OrderIdStrategy = OrderIdStrategy.INCREMENT, read_only: bool = True, is_fa: bool = False):
430430
self._host = host
431431
self._port = port
432432
self._client_id = client_id
@@ -1166,7 +1166,7 @@ def order_cancel(self, order_id: int) -> None:
11661166

11671167
self._assert_connected()
11681168
self._assert_read_write()
1169-
self._client.cancelOrder(orderId=order_id)
1169+
self._client.cancelOrder(orderId=order_id, manualCancelOrderTime="")
11701170

11711171
def order_cancel_all(self) -> None:
11721172
"""Cancel all open orders.

src/deephaven_ib/_tws/order_id_queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class OrderIdEventQueue:
7373
_last_value: int
7474
_request_thread: Thread
7575

76-
def __init__(self, client: 'IbTwsClient', strategy: OrderIdStrategy = OrderIdStrategy.RETRY):
76+
def __init__(self, client: 'IbTwsClient', strategy: OrderIdStrategy):
7777
self._events = []
7878
self._values = []
7979
self._lock = LoggingLock("OrderIdEventQueue")

0 commit comments

Comments
 (0)