Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBKR adapter imports unsupported UNSET_DECIMAL from ibapi #2204

Closed
jankleinsorge opened this issue Jan 11, 2025 · 3 comments
Closed

IBKR adapter imports unsupported UNSET_DECIMAL from ibapi #2204

jankleinsorge opened this issue Jan 11, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@jankleinsorge
Copy link

jankleinsorge commented Jan 11, 2025

Toying with package versions

nautilus-ibapi 10.19.4
nautilus_trader 1.210.0
ibapi 9.81.1.post1

and example

https://github.com/nautechsystems/nautilus_trader/blob/develop/examples/live/interactive_brokers/connect_with_tws.py

for a direct TWS-connection (so non-containerized) yields an import error regarding UNSET_DECIMAL

Traceback (most recent call last):
  File "<...>", line 19, in <module>
      from nautilus_trader.adapters.interactive_brokers.config import IBMarketDataTypeEnum
        File "<...>/lib/python3.11/site-packages/nautilus_trader/adapters/interactive_brokers/config.py", line 23, in <module>
            from nautilus_trader.adapters.interactive_brokers.common import IBContract
              File "<...>/lib/python3.11/site-packages/nautilus_trader/adapters/interactive_brokers/common.py", line 19, in <module>
                  from ibapi.common import UNSET_DECIMAL
                  ImportError: cannot import name 'UNSET_DECIMAL' from 'ibapi.common' (<...>/lib/python3.11/site-packages/ibapi/common.py)

where UNSET_DECIMAL is indeed not present (anymore or yet?) in said ibapi version.

Expected Behavior

No import error

Actual Behavior

Import error as described above

Steps to Reproduce the Problem

  1. Try given example from example/ directory under given package versions (current stable versions as of today)

Specifications

  • WSL2/debian 12.8
  • Python 3.11.2
  • nautilus_trader 1.210.0
@jankleinsorge jankleinsorge added the bug Something isn't working label Jan 11, 2025
@jankleinsorge
Copy link
Author

Original constant seems to have been 'UNSET_DECIMAL = 1e10'.
It seems incompatilbity goes deeper. Follow up issue is:
ImportError: cannot import name 'ListOfHistoricalSessions' from 'ibapi.common'
I will stop here in order not to spam the ticket.

@cjdsellers
Copy link
Member

Hi @jankleinsorge

Thanks for the report.

Could it be because you have both the ibapi and nautilus-ibapi packages installed?

Because it looks like that constant is indeed there https://github.com/nautechsystems/nautilus_ibapi/blob/d1133f23e3a10f819c9ad0585ece5b9dc7bf263a/ibapi/common.py#L21

Preemptively closing for now, but we can keep discussing here if you believe there is still an issue.

@jankleinsorge
Copy link
Author

@cjdsellers correct assessment. 'ibapi' gets precedence in this setup and seems to have diverted. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants