bmoscon / cryptofeed

Cryptocurrency Exchange Websocket Data Feed Handler
Other
2.2k stars 679 forks source link

HUOBI_SWAP error #342

Closed yohplala closed 3 years ago

yohplala commented 3 years ago

Describe the bug I get following error message from HUOBI_SWAP.

2020-12-02 21:46:59,329 : ERROR : HUOBI_SWAP: encountered an exception, reconnecting
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/cryptofeed-1.6.2-py3.8.egg/cryptofeed/feedhandler.py", line 258, in _connect
    await self._handler(websocket, feed.message_handler, feed.uuid)
  File "/usr/local/lib/python3.8/dist-packages/cryptofeed-1.6.2-py3.8.egg/cryptofeed/feedhandler.py", line 287, in _handler
    await handler(message, self.last_msg[feed_id])
  File "/usr/local/lib/python3.8/dist-packages/cryptofeed-1.6.2-py3.8.egg/cryptofeed/exchange/huobi_dm.py", line 130, in message_handler
    await self._book(msg, timestamp)
  File "/usr/local/lib/python3.8/dist-packages/cryptofeed-1.6.2-py3.8.egg/cryptofeed/exchange/huobi_dm.py", line 79, in _book
    for price, amount in data['bids']
KeyError: 'bids'

To Reproduce Everything was working ok since several days, so I suspect there has been a change with HUOBI_SWAP API or with HUOBI_SWAP server maybe?

Expected behavior The error message is pretty clear. IMHO, 2 things could be improved:

Well, I feel, such an error should not cause a 'ERROR : HUOBI_SWAP: encountered an exception, reconnecting'.

Cryptofeed Version 1.6.2

yohplala commented 3 years ago

Here is the configuration for HUOBI_SWAP.

    HUOBI_SWAP:
        channel_timeouts:
            trades: 90
            l2_book: 90
        retries: -1
        trades: [AAVE-USD,ADA-USD,AKRO-USD,ALGO-USD,ANKR-USD,BAT-USD,BTC-USD,LUNA-USD,MKR-USD,NEAR-USD,NEO-USD,THETA-USD,UNI-USD]
        l2_book:
            symbols: [AAVE-USD,ADA-USD,AKRO-USD,ALGO-USD,ANKR-USD,BAT-USD,BTC-USD,LUNA-USD,MKR-USD,NEAR-USD,NEO-USD,THETA-USD,UNI-USD]
            book_delta: true
            book_interval: 100000
bmoscon commented 3 years ago

see https://huobiglobal.zendesk.com/hc/en-us/articles/900003742046-Announcement-on-the-Delisting-of-Some-Assets-for-Huobi-Coin-margined-Swaps

some of their trading pairs are being delisted, so are no longer valid.

bmoscon commented 3 years ago

i put in some code to have it ignore empty book updates

yohplala commented 3 years ago

Bryant, do you think there could be a warning message indicating that a pair is not in the response and probably delisted? I believe having detailed warnings or erros to set user on a track are great added value.