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

Bitmex - Trade Subscription giving an error on expiry #1011

Open
pavs94 opened this issue Feb 5, 2024 · 1 comment
Open

Bitmex - Trade Subscription giving an error on expiry #1011

pavs94 opened this issue Feb 5, 2024 · 1 comment
Labels

Comments

@pavs94
Copy link

pavs94 commented Feb 5, 2024

Describe the bug
Bitmex Trade subscription is crashing with a weird error in the library

To Reproduce
Steps to reproduce the behavior:

f = FeedHandler()
f.add_feed(Bitmex(symbols=['BTC-USD-PERP'], channels=[TRADES], callbacks={TRADES: bitmex_trade}))

Expected behavior

  • No Error when subscribing to trades

Screenshots

File "/home/ubuntu/xxxxxx/venv/lib/python3.11/site-packages/cryptofeed/exchanges/bitmex.py", line 61, in _parse_symbol_data
3|Websocket Price trigger  |     s = Symbol(base, quote, type=stype, expiry_date=entry['expiry'])
3|Websocket Price trigger  |                                                     ~~~~~^^^^^^^^^^
KeyError: 'expiry'

Operating System:

  • ubuntu

Cryptofeed Version

  • 2.4.0
@pavs94 pavs94 added the bug label Feb 5, 2024
@caolanraff
Copy link

caolanraff commented Feb 13, 2024

I tried creating a PR for this fix but unfortunately I don't have the correct permissions.
This is the required change in bitmex.py:

            if entry['typ'] == 'FFWCSX':
                stype = PERPETUAL
                expiry = None
            elif entry['typ'] == 'FFCCSX':
                stype = FUTURES
                expiry = entry['expiry']
            elif entry['typ'] == 'IFXXXP':
                stype = SPOT
                expiry = None
            else:
                LOG.info('Unsupported type %s for instrument %s', entry['typ'], entry['symbol'])

            s = Symbol(base, quote, type=stype, expiry_date=expiry)

As BitMEX no longer sends values in the instrument feed if they are null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants