0

I am new to Python, and I am using PyDev in Eclipse to practice Python, the interpreter is Python 3.5.

I am trying to develop Python code to access Interactive Brokers, simply copying the code described in the link:

https://www.quantstart.com/articles/using-python-ibpy-and-the-interactive-brokers-api-to-automate-trades

I downloaded the latest IBPY library (ib-0.8.0), and installed it using command

python setup.py install

However, I got errors at the very beginning after I copied the code

   from ib.ext.Contract import Contract
   from ib.ext.Order import Order
   from ib.opt import Connection, message

PyDev show unresolved import for Contract, Order, and Connection, message

I checked the extracted library folder for IBPY, they are all there

Can someone help me findout what is the reason?

Thanks a lot!

kevin
  • 159
  • 3
  • 9

2 Answers2

0

The problem is resolved, the IBPY source code contains errors

python setup.py install

report code syntax errors, after I correct the errors, the unresolved import problem disappear, it seems the source was corrupted

kevin
  • 159
  • 3
  • 9
0

Solve the problem by running:

pip3 install ibapi 
omajid
  • 14,165
  • 4
  • 47
  • 64
  • ibpy and ibapi are 2 different packages. The ibapi package from pip is not the official source for ibapi. Read here https://stackoverflow.com/a/57618526/2855515 – brian Jul 16 '20 at 20:23