ib-api-reloaded / ib_async

Python sync/async framework for Interactive Brokers API (replaces ib_insync)
BSD 2-Clause "Simplified" License
467 stars 73 forks source link

is this a drop in of ib_insync? #63

Closed disaster123 closed 2 months ago

disaster123 commented 3 months ago

Hi,

i don't find any migration hints. Can i just replace ib_insync with ib_async?

Thx!

Greets

August1328 commented 3 months ago

yes, just replace the old module name with the new one.

same topic in discussions

disaster123 commented 3 months ago

@August1328 to me this does not work.

I did:

git clone https://github.com/ib-api-reloaded/ib_async
import sys
sys.path.append(r'./ib_async/')

from ib_async import *

but this results in:

Traceback (most recent call last):
  File "/opt/metaibcopy/ib-client.py", line 11, in <module>
    import ibkr2
  File "/opt/metaibcopy/ibkr2.py", line 5, in <module>
    from ib_async import *
  File "./ib_async/ib_async/__init__.py", line 105, in <module>
    from .version import __version__, __version_info__
  File "./ib_async/ib_async/version.py", line 5, in <module>
    __version__ = version("ib_async")
  File "/usr/lib/python3.9/importlib/metadata.py", line 551, in version
    return distribution(distribution_name).version
  File "/usr/lib/python3.9/importlib/metadata.py", line 524, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.9/importlib/metadata.py", line 187, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: ib_async
August1328 commented 2 months ago

I am not familiar with every OS, but did you try pip install ib_async?

praditik commented 2 months ago

I am certain that this can be resolved by using installation using pip as @August1328 pointed above. The problem in your case is you have cloned the repository but it is not installed in the environment. So, import statement fails. Please try pip install ib_async and then it should run fine.

If resolved already, you can close the issue.

disaster123 commented 2 months ago

OK the reason is the modfied version.py - the original one worked without any pip install. I've reverted to the old version.py ;-) works now. Thanks a lot!

mattsta commented 2 months ago

File "/usr/lib/python3.9/importlib/metadata.py", line 187, in from_name

Yes, very much true. The minimum Python version is 3.10 right now and it will continue to increase over time. Python 3.9 is almost 5 years old by now :(