[Python] IB().connect raises TimeoutError in ib_insync library

Discussão em 'Python' iniciado por Stack, Junho 19, 2025.

  1. Stack

    Stack Membro Participativo

    I have been trying to place orders using the ib_insync library in through IBKR trading workstation. In one of the accounts there is an error in IB.connect and it raises TimeoutError. here is the line:

    ib = IB().connect('127.0.0.1', 7496, clientId=123)


    Error
    Traceback (most recent call last):
    File "...Python\Python310\lib\tkinter\_init.py", line 1921, in __call__
    return self.func(*args)
    File "nq_ibkr_algo.py", line 193, in initiate_functionalities
    self.ib, self.contract = self.ib_connection()
    File "nq_ibkr_algo.py", line 452, in ib_connection
    ib = IB().connect('127.0.0.1', 7496, clientId=123)

    File "venv\lib\site-packages\ib_insync\ib.py", line 279, in connect
    return self._run(self.connectAsync(
    File "venv\lib\site-packages\ib_insync\ib.py", line 318, in _run
    return util.run(*awaitables, timeout=self.RequestTimeout)
    File "venv\lib\site-packages\ib_insync\util.py", line 341, in run
    result = loop.run_until_complete(task)
    File "Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
    File "venv\lib\site-packages\ib_insync\ib.py", line 1782, in connectAsync
    await asyncio.wait_for(self.reqExecutionsAsync(), timeout)
    File "Python\Python310\lib\asyncio\tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
    asyncio.exceptions.TimeoutError


    I was expecting it to run smoothly like other accounts of IBKR but having issue with some specific trading accounts.

    This error likely seems to be library related. It would be very helpful if someone could help me out with this.

    Thank you

    Continue reading...

Compartilhe esta Página