slazarov / python-bittrex-websocket

Python websocket for Bittrex (non async).
http://python-bittrex-websocket-docs.readthedocs.io/en/latest/index.html
MIT License
103 stars 38 forks source link

New Errors #44

Closed rightx2 closed 6 years ago

rightx2 commented 6 years ago

My ticker list : ['BTC-ZCL', 'BTC-NEO', 'BTC-BCPT', 'BTC-ADA', 'BTC-ETH', 'BTC-ETC', 'BTC-OMG', 'BTC-LTC', 'BTC-RDD', 'BTC-XRP', 'BTC-XVG', 'BTC-BCC', 'BTC-XLM', 'BTC-BITB', 'BTC-SC', 'BTC-XMR', 'BTC-NBT', 'BTC-LSK', 'BTC-DOGE', 'BTC-MEME', 'ETH-NEO', 'ETH-ADA', 'ETH-OMG', 'ETH-XRP', 'ETH-WAX', 'USDT-BTC', 'USDT-NEO', 'USDT-ETH', 'USDT-LTC', 'USDT-ETC']

When I execute my code:

.
.
.
ion][OrderBook][USDT-ETH]: Order book snapshot requested.
2018-02-28 09:04:36 - bittrex_websocket.websocket_client - INFO - [Subscription][OrderBook][ETH-OMG]: Order book snapshot requested.
2018-02-28 09:04:36 - bittrex_websocket.websocket_client - INFO - [Subscription][OrderBook][USDT-NEO]: Order book snapshot requested.
2018-02-28 09:04:36 - bittrex_websocket.websocket_client - INFO - [Subscription][OrderBook][ETH-XRP]: Order book snapshot requested.
2018-02-28 09:04:36 - bittrex_websocket.websocket_client - INFO - [Subscription][OrderBook][USDT-LTC]: Order book snapshot requested.
2018-02-28 09:04:36 - bittrex_websocket.websocket_client - INFO - [Subscription][OrderBook][USDT-BTC]: Order book snapshot requested.
2018-02-28 09:04:36 - bittrex_websocket.websocket_client - INFO - [Subscription][OrderBook][ETH-NEO]: Order book snapshot requested.
ETH-NEO  is wrong
Traceback (most recent call last):
  File "/home/rightx2/.pyenv/versions/coin_trader_project/lib/python3.6/site-packages/bittrex_websocket/websocket_client.py", line 989, in _transfer_backorder_queue2
    e = q.get(False)
AttributeError: 'NoneType' object has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rightx2/.pyenv/versions/coin_trader_project/lib/python3.6/site-packages/gevent/greenlet.py", line 537, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/rightx2/.pyenv/versions/coin_trader_project/lib/python3.6/site-packages/signalr/_connection.py", line 53, in wrapped_listener
    listener()
  File "/home/rightx2/.pyenv/versions/coin_trader_project/lib/python3.6/site-packages/signalr/transports/_ws_transport.py", line 43, in _receive
    self._handle_notification(notification)
  File "/home/rightx2/.pyenv/versions/coin_trader_project/lib/python3.6/site-packages/signalr/transports/_transport.py", line 50, in _handle_notification
    self._connection.received.fire(**data)
  File "/home/rightx2/.pyenv/versions/coin_trader_project/lib/python3.6/site-packages/signalr/events/_events.py", line 15, in fire
    handler(*args, **kwargs)
  File "/home/rightx2/.pyenv/versions/coin_trader_project/lib/python3.6/site-packages/bittrex_websocket/websocket_client.py", line 1016, in _on_debug
    self._is_orderbook_snapshot(kwargs)
  File "/home/rightx2/.pyenv/versions/coin_trader_project/lib/python3.6/site-packages/bittrex_websocket/websocket_client.py", line 949, in _is_orderbook_snapshot
    if self._transfer_backorder_queue2(ticker, msg['R']):
  File "/home/rightx2/.pyenv/versions/coin_trader_project/lib/python3.6/site-packages/bittrex_websocket/websocket_client.py", line 996, in _transfer_backorder_queue2
    raise NotImplementedError('Please report error to '
NotImplementedError: Please report error to https://github.com/slazarov/python-bittrex-websocket, Error:_transfer_backorder_queue:AttributeError
Wed Feb 28 09:04:36 2018 <Greenlet at 0x7f81cae8bf20: wrapped_listener> failed with NotImplementedError

2018-02-28 09:04:36 - bittrex_websocket.websocket_client - INFO - [Connection][f41ebe46fee04fe2b975e32bc6174dc9]:Trying to establish connection to Bittrex through https://socket.bittrex.com/signalr.
2018-02-28 09:04:42 - bittrex_websocket.websocket_client - INFO - [Connection][f41ebe46fee04fe2b975e32bc6174dc9]:Connection to Bittrex established successfully through https://socket.bittrex.com/signalr
.
.
.

I added code for debuging in the library (line number 995):

 982     def _transfer_backorder_queue2(self, ticker, snapshot):
 983         confirmed = False
 984         sub = self.tickers.list[ticker][SUB_TYPE_ORDERBOOK]
 985         q = sub['InternalQueue']
 986         q2 = queue.Queue()
 987         while True:
 988             try:
 989                 e = q.get(False)
 990                 q2.put(e)
 991             except queue.Empty:
 992                 sub['InternalQueue'] = q2
 993                 return confirmed
 994             except AttributeError:
 995                 print(ticker, " is wrong")
 996                 raise NotImplementedError('Please report error to '
 997                                           'https://github.com/slazarov/python-bittrex-websocket, '
 998                                           'Error:_transfer_backorder_queue:AttributeError')
 999             else:
1000                 if self._confirm_order_book(snapshot, e):
1001                     confirmed = True
1002                 q.task_done()

If you see the error log again, there is a log, "ETH-NEO is wrong".

Why does this happen?

I still used 0.0.6.4 but it occured 0.0.7.0, too !

(Only difference is whether program STOP or not due to the error. )

slazarov commented 6 years ago

I have an idea about what’s causing it and will try to fix it this week. I actually posted in a the other issue by mistake, so do you get this after reconnection?

slazarov commented 6 years ago

Closing issue since the code has been entirely rewritten, hence it's not applicable.