0

I would like to connect with the TWS API for python however when I tried there was an error saying unable to connect with TWS and that I need to make sure that the TWS port is open. I am unsure what they mean by this.

This is some of my code:

from ib_insync import *
util.startLoop()
ib=IB()
ib.connect("127.001", 7497)
Mihai Chelaru
  • 7,614
  • 14
  • 45
  • 51

1 Answers1

0

You have to add a client ID to the ib connect Also a valid IP address has three dots, so 127.0.0.1 instead of 127.001

from ib_insync import * 
util.startLoop
ib=IB()
ib.connect("127.0.0.1", 7497, clientId=1)
  • thank you so much it worked . do you know of any resources where can learn more about algorithmic trading in python as well as using the ib isync package . thank you –  Aug 15 '19 at 15:43