ib_insync
ib_insync copied to clipboard
ib_insync connection issue on a Mac
I have problem connecting to IB using ib_insync on a Mac, but without any problem on a PC. Below are some details:
The ib_insync code I ran is simple, and the same across systems. The setup for TWS seems to have no issue. import ib_insync as ibis ib = ibis.IB() ib.connect('127.0.0.1', 7497, clientId=1)
Once I ran these three lines on a Mac, the Spyder console keeps running without any error message. I have two Macs, both having the same issue. I have no problem connecting to IB on a PC using this code.
I have no issue to connect to IB using IB's own code. That is, from ibapi.client import EClient from ibapi.wrapper import EWrapper class MyWrapper(EWrapper): def init(self): super().init() wrapper = MyWrapper() client = EClient(wrapper) client.connect("127.0.0.1", 7497, clientId=1) client.run()
However, when I ran the ib_insync code above after this, it freezes again. When I restart the kernel, the IB code no longer works, unless I restart the TWS and re login.