Closed evergreen2mdt closed 1 year ago
This error could be caused by several reasons. One possibility is that the ib_insync library is not installed correctly or there is a problem with the installation. You can try reinstalling the library by running "pip install --upgrade ib_insync" in your command prompt/terminal.
Another possibility is that there is a naming conflict with another file or module named ib_insync. Make sure that you do not have any other files or modules with the same name in your working directory or PYTHONPATH.
It may help you.
File "C:\Users\evergreen\PycharmProjects\ib_insync.py", line 4, in
Rename your script to something other than ib_insync.py.
Hi. New here. I'm having a great deal of trouble importing ib_insync. Any help would be great. I pasted the following code:
from ib_insync import *
util.startLoop() # uncomment this line when in a notebook
ib = IB() ib.connect('127.0.0.1', 7497, clientId=1)
contract = Forex('EURUSD') bars = ib.reqHistoricalData( contract, endDateTime='', durationStr='30 D', barSizeSetting='1 hour', whatToShow='MIDPOINT', useRTH=True)
convert to pandas dataframe:
df = util.df(bars) print(df)
The error I receive is always:
C:\Users\evergreen\PycharmProjects\venv\Scripts\python.exe C:\Users\colby\PycharmProjects\test.py Traceback (most recent call last): File "C:\Users\evergreen\PycharmProjects\test.py", line 1, in
from ib_insync import *
File "C:\Users\evergreen\PycharmProjects\ib_insync.py", line 4, in
ib = IB()
^^
NameError: name 'IB' is not defined