slazarov/python-bittrex-websocket

'NoneType' object has no attribute 'callback'

kierangraham opened this issue · 14 comments

Since v0.0.6.3 I keep having this error published out so reporting as requested. I've included my log & script.

'NoneType' object has no attribute 'callback'
Got this exception from _on_tick_update. This is bug testing. Please report to https://github.com/slazarov/python-bittrex-websocket with this message
2018-02-24 10:16:06 - bittrex_websocket.websocket_client - INFO - [Connection][6a532f19f19041a3bb5f9ad680950737]:Connection to Bittrex established successfully through https://socket-stage.bittrex.com/signalr
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-XVC]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-MEME]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-STEEM]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-2GIVE]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-LSK]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-PDC]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-BRK]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-WAVES]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-LBC]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-SBD]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-BRX]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-ETC]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][ETH-ETC]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-STRAT]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-UNB]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-SYNX]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-EBST]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-VRM]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-SEQ]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket._auxiliary - INFO - [Subscription][Trades][BTC-REP]: Enabled.
2018-02-24 10:16:06 - bittrex_websocket.websocket_client - INFO - [Connection][350f35bf2d82479697716a6926932e46]:Trying to establish connection to Bittrex through https://socket-stage.bittrex.com/signalr.
from __future__ import print_function
from time import sleep
from bittrex_websocket.websocket_client import BittrexSocket
import os
import json
import redis
from bittrex.bittrex import Bittrex

def main():
  class SocketHandler(BittrexSocket):
    def on_open(self):
      self.redis = redis.Redis.from_url(os.environ['REDIS_URL'])

    def on_trades(self, msg):
      # print('[Trades]: {}'.format(msg['ticker']))

      for trade in msg['trades']:
        trade_json = {
          'exchange': 'bittrex',
          'base': msg['ticker'].split('-')[0].lower(),
          'quote': msg['ticker'].split('-')[1].lower(),
          'kind': trade['OrderType'].lower(),
          'quantity': trade['Quantity'],
          'price': trade['Rate'],
          'timestamp': trade['TimeStamp'],
        }

        print(json.dumps(trade_json))

        self.redis.publish('bittrex:trade:' + msg['ticker'].lower(), json.dumps(trade_json))

      # print('')

    def on_ticker_update(self, msg):
      price = {
        'base': msg['MarketName'].split('-')[0].lower(),
        'quote': msg['MarketName'].split('-')[1].lower(),
        'price': msg['Last'],
      }

      print(json.dumps(price))

      self.redis.publish('bittrex:price:' + price['base'] + '-' + price['quote'], price['price'])
      self.redis.set('bittrex:price:' + price['base'] + '-' + price['quote'], price['price'])

      # print('')

  # Define tickers
  bittrex = Bittrex(None, None)
  tickers = list(map(lambda market: market['MarketName'], bittrex.get_markets()['result']))

  print(tickers)

  # Create the socket instance
  ws = SocketHandler()

  # Enable logging
  ws.enable_log()

  # Subscribe to trade fills
  ws.subscribe_to_trades(tickers)
  ws.subscribe_to_ticker_update(tickers)

  while True:
    sleep(1)

if __name__ == "__main__":
  main()

Hi @kierangraham, these error handlers were integrated as of 0.0.6.3 in order to capture a bug with thewebsocket library. However, the bug is not coming from these methods so I have removed them.

Uninstall the library and do a pip install git+https://github.com/slazarov/python-bittrex-websocket.git and reply back.

++ cheers for the exemplary issue posting :)

Errors are all gone now, thanks @slazarov 😄


A random question, I'm running this in Docker and suddenly is unable to connect to the socket. Something you've come across? Not sure what to put in a new issue that would help yet... I'm getting log output like this continuously:

history_1  | 2018-02-24 20:21:10 - bittrex_websocket.websocket_client - INFO - [Connection][b95f4e70ccd9473881c2ee7c25f16b0b]:Trying to establish connection to Bittrex through https://socket-stage.bittrex.com/signalr.
history_1  | 2018-02-24 20:21:15 - bittrex_websocket.websocket_client - ERROR - [Connection][b95f4e70ccd9473881c2ee7c25f16b0b]:Timeout for url https://socket-stage.bittrex.com/signalr. Please check your internet connection is on.
history_1  | 2018-02-24 20:21:15 - bittrex_websocket.websocket_client - INFO - [Connection][b95f4e70ccd9473881c2ee7c25f16b0b]:Trying to establish connection to Bittrex through https://socket.bittrex.com/signalr.
history_1  | 2018-02-24 20:21:20 - bittrex_websocket.websocket_client - ERROR - [Connection][b95f4e70ccd9473881c2ee7c25f16b0b]:Timeout for url https://socket.bittrex.com/signalr. Please check your internet connection is on.
history_1  | 2018-02-24 20:21:20 - bittrex_websocket.websocket_client - ERROR - [Connection][b95f4e70ccd9473881c2ee7c25f16b0b]:Failed to establish connection through supplied URLS. Leaving to watchdog...

The super weird part is that this works outside of Docker perfectly fine, which makes no sense to me...

In the past I thought that the error is related to a dropped connection and I haven't edited it since.
The specific exception you are getting is from urllib3.contrib.pyopenssl import SocketError.

I haven't researched it thoroughly but it might be due to monkey patching.
Can you try running the code in a python3 venv?

That's the weirdest thing, I'm running using a pipenv environment which works fine on my local machine (outside of Docker) and fails with the error above when run from Docker.

Python isn't something I'm exposed to often so I could be missing or doing something pretty basic.

Dockerfile

FROM python:3.6

RUN apt-get update -qq && apt-get install -y git nodejs

ENV APP /app
WORKDIR $APP

RUN pip install pipenv

ADD Pipfile Pipfile
ADD Pipfile.lock Pipfile.lock

RUN pipenv --python 3.6
RUN pipenv install

ADD . $APP

Docker Compose

version: '2.3'
services:
  history:
    build: .
    command: pipenv run python history.py
    links:
      - redis
    volumes:
      - '.:/app'
    depends_on:
      - redis
  redis:
    image: redis:4.0.6
    restart: 'on-failure'

Pipfile

[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

"asn1crypto" = "==0.24.0"
bittrex-websocket = "==0.0.6.4"
certifi = "==2018.1.18"
cffi = "==1.11.4"
cfscrape = "==1.9.4"
chardet = "==3.0.4"
cryptography = "==2.1.4"
Events = "==0.3"
gevent = "==1.3a1"
greenlet = "==0.4.13"
idna = "==2.6"
pycparser = "==2.18"
PyExecJS = "==1.5.1"
pyOpenSSL = "==17.5.0"
python-bittrex = "==0.3.0"
redis = "==2.10.6"
requests = "==2.18.4"
signalr-client = "==0.0.7"
sseclient = "==0.0.18"
"urllib3" = "==1.22"
websocket-client = "==0.47.0"


[dev-packages]

Python Script

from __future__ import print_function
from time import sleep
from bittrex_websocket.websocket_client import BittrexSocket
import os
import json
from redis import Redis
from bittrex.bittrex import Bittrex

print("Loading...")

def main():
  class SocketHandler(BittrexSocket):
    def on_open(self):
      print("Socket to Bittrex opened!")

    def on_trades(self, msg):
      redis = Redis.from_url(os.environ['REDIS_URL'])

      for trade in msg['trades']:
        trade_json = {
          'exchange': 'bittrex',
          'base': msg['ticker'].split('-')[0].lower(),
          'quote': msg['ticker'].split('-')[1].lower(),
          'kind': trade['OrderType'].lower(),
          'quantity': trade['Quantity'],
          'price': trade['Rate'],
          'timestamp': trade['TimeStamp'],
        }

        print(json.dumps(trade_json))

        redis.publish('bittrex:trade:' + msg['ticker'].lower(), json.dumps(trade_json))

    def on_ticker_update(self, msg):
      redis = Redis.from_url(os.environ['REDIS_URL'])

      price = {
        'base': msg['MarketName'].split('-')[0].lower(),
        'quote': msg['MarketName'].split('-')[1].lower(),
        'price': msg['Last'],
      }

      print(json.dumps(price))

      redis.publish('bittrex:price:' + price['base'] + '-' + price['quote'], price['price'])
      redis.set('bittrex:price:' + price['base'] + '-' + price['quote'], price['price'])

  # Define tickers
  bittrex = Bittrex(None, None)

  tickers = list(map(lambda market: market['MarketName'], bittrex.get_markets()['result']))

  print(tickers)

  # Create the socket instance
  ws = SocketHandler()

  # Enable logging
  ws.enable_log()

  # Subscribe to trade fills
  ws.subscribe_to_trades(tickers)
  ws.subscribe_to_ticker_update(tickers)

  while True:
    sleep(1)

if __name__ == "__main__":
  main()

@kierangraham can you confirm that the supplied dockerfile + example.py work?

FROM python:3.6.3-alpine

RUN   apk update && apk add --no-cache --virtual .build-deps \
      g++ make libffi-dev openssl-dev git nodejs && \
      pip install 'cython>=0.25' && \
      pip install git+https://github.com/slazarov/python-bittrex-websocket.git@ && \
      apk del .build-deps && \
      rm -rf /var/cache/apk/*

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
ADD . /app

# Run app.py when the container launches
CMD ["python", "example.py"]

Nope also doesn't work for me 😞 – same error.

history_1  | 2018-02-25 09:18:10 - bittrex_websocket.websocket_client - INFO - [Connection][fb9d333fe2454e8cb775b718727ee389]:Trying to establish connection to Bittrex through https://socket-stage.bittrex.com/signalr.
history_1  | 2018-02-25 09:18:15 - bittrex_websocket.websocket_client - ERROR - [Connection][fb9d333fe2454e8cb775b718727ee389]:Timeout for url https://socket-stage.bittrex.com/signalr. Please check your internet connection is on.
history_1  | 2018-02-25 09:18:15 - bittrex_websocket.websocket_client - INFO - [Connection][fb9d333fe2454e8cb775b718727ee389]:Trying to establish connection to Bittrex through https://socket.bittrex.com/signalr.
history_1  | 2018-02-25 09:18:21 - bittrex_websocket.websocket_client - ERROR - [Connection][fb9d333fe2454e8cb775b718727ee389]:Timeout for url https://socket.bittrex.com/signalr. Please check your internet connection is on.
history_1  | 2018-02-25 09:18:21 - bittrex_websocket.websocket_client - ERROR - [Connection][fb9d333fe2454e8cb775b718727ee389]:Failed to establish connection through supplied URLS. Leaving to watchdog...
history_1  | 2018-02-25 09:18:30 - bittrex_websocket.websocket_client - ERROR - Failed to subscribe [OrderBook][['BTC-ETH', 'BTC-NEO', 'BTC-ZEC', 'ETH-NEO', 'ETH-ZEC']] from connection fb9d333fe2454e8cb775b718727ee389 af

Hey mate, I just ran the dockerfile myself. I am confirming the same error. For the time being, please run the library outside of docker. I will look into this as soon as I finish the reconnection handling. Best!

No worries, thanks for you help on these questions, really appreciate it :)

I’ll try to figure out what’s different as my small app worked a few weeks ago when I first set it up, if you find something new please let me know!

I’ll close this issue since what we’re discussing has nothing to do with the original issue.

Great, thanks as well :)

@slazarov Hey 👋 , wondering if you'd any new news on this not running in Docker? I've tried updating and still the exact same result.

Have you tried updating after the PR?

@slazarov Which PR? I've tried 0.0.7.0 & what's currently on master with the same results. When in Docker there's just a failure to connect to the socket. Dockerfile and code I'm running is the same as earlier in the thread only difference is I've updated the library.

@kierangraham this is what I get:

$ docker build -t bittrex_socket . && docker run bittrex_socket

Build

Sending build context to Docker daemon 4.608kB
Step 1/5 : FROM python:3.6.3-alpine
---> 83da41380580
Step 2/5 : RUN apk update && apk add --no-cache --virtual .build-deps g++ make libffi-dev openssl-dev git && apk --update add nodejs && pip install 'cython>=0.25' && pip install git+https://github.com/slazarov/python-bittrex-websocket.git@ && apk del .build-deps && rm -rf /var/cache/apk/*
---> Running in 3ca5eaf40183
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
v3.4.6-293-g965f9d8 [http://dl-cdn.alpinelinux.org/alpine/v3.4/main]
v3.4.6-160-g14ad2a3 [http://dl-cdn.alpinelinux.org/alpine/v3.4/community]
OK: 5980 distinct packages available
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/27) Installing libgcc (5.3.0-r0)
(2/27) Installing libstdc++ (5.3.0-r0)
(3/27) Installing binutils-libs (2.26-r1)
(4/27) Installing binutils (2.26-r1)
(5/27) Installing gmp (6.1.0-r0)
(6/27) Installing isl (0.14.1-r0)
(7/27) Installing libgomp (5.3.0-r0)
(8/27) Installing libatomic (5.3.0-r0)
(9/27) Installing pkgconf (0.9.12-r0)
(10/27) Installing pkgconfig (0.25-r1)
(11/27) Installing mpfr3 (3.1.2-r0)
(12/27) Installing mpc1 (1.0.3-r0)
(13/27) Installing gcc (5.3.0-r0)
(14/27) Installing musl-dev (1.1.14-r16)
(15/27) Installing libc-dev (0.7-r0)
(16/27) Installing g++ (5.3.0-r0)
(17/27) Installing make (4.1-r1)
(18/27) Installing libffi-dev (3.2.1-r2)
(19/27) Installing zlib-dev (1.2.11-r0)
(20/27) Upgrading libcrypto1.0 (1.0.2k-r0 -> 1.0.2n-r0)
(21/27) Upgrading libssl1.0 (1.0.2k-r0 -> 1.0.2n-r0)
(22/27) Installing openssl-dev (1.0.2n-r0)
(23/27) Installing libssh2 (1.7.0-r0)
(24/27) Installing libcurl (7.59.0-r0)
(25/27) Installing pcre (8.38-r1)
(26/27) Installing git (2.8.6-r0)
(27/27) Installing .build-deps (0)
Executing busybox-1.24.2-r13.trigger
OK: 206 MiB in 59 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/2) Installing libuv (1.9.1-r0)
(2/2) Installing nodejs (6.7.0-r1)
Executing busybox-1.24.2-r13.trigger
OK: 240 MiB in 61 packages
Collecting cython>=0.25
Downloading Cython-0.28.1.tar.gz (1.8MB)
Building wheels for collected packages: cython
Running setup.py bdist_wheel for cython: started
Running setup.py bdist_wheel for cython: still running...
Running setup.py bdist_wheel for cython: still running...
Running setup.py bdist_wheel for cython: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/f7/99/91/ef5b1e21d490288f8e5475e2c2a78e9fb19fafc8b270499f42
Successfully built cython
Installing collected packages: cython
Successfully installed cython-0.28.1
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting git+https://github.com/slazarov/python-bittrex-websocket.git@
Cloning https://github.com/slazarov/python-bittrex-websocket.git to /tmp/pip-_o5cai5n-build
Collecting cfscrape>=1.9.4 (from bittrex-websocket==0.0.7.2)
Downloading cfscrape-1.9.4.tar.gz
Collecting requests[security]==2.18.4 (from bittrex-websocket==0.0.7.2)
Downloading requests-2.18.4-py2.py3-none-any.whl (88kB)
Collecting Events==0.3 (from bittrex-websocket==0.0.7.2)
Downloading Events-0.3.tar.gz
Collecting websocket-client>=0.47.0 (from bittrex-websocket==0.0.7.2)
Downloading websocket_client-0.47.0-py2.py3-none-any.whl (200kB)
Collecting gevent>=1.3a1 (from bittrex-websocket==0.0.7.2)
Downloading gevent-1.3a2.tar.gz (4.1MB)
Collecting signalr-client-slazarov==0.0.7.2 (from bittrex-websocket==0.0.7.2)
Downloading signalr_client_slazarov-0.0.7.2-py2.py3-none-any.whl
Collecting PyExecJS>=1.4.0 (from cfscrape>=1.9.4->bittrex-websocket==0.0.7.2)
Downloading PyExecJS-1.5.1.tar.gz
Collecting urllib3<1.23,>=1.21.1 (from requests[security]==2.18.4->bittrex-websocket==0.0.7.2)
Downloading urllib3-1.22-py2.py3-none-any.whl (132kB)
Collecting chardet<3.1.0,>=3.0.2 (from requests[security]==2.18.4->bittrex-websocket==0.0.7.2)
Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
Collecting certifi>=2017.4.17 (from requests[security]==2.18.4->bittrex-websocket==0.0.7.2)
Downloading certifi-2018.1.18-py2.py3-none-any.whl (151kB)
Collecting idna<2.7,>=2.5 (from requests[security]==2.18.4->bittrex-websocket==0.0.7.2)
Downloading idna-2.6-py2.py3-none-any.whl (56kB)
Collecting cryptography>=1.3.4; extra == "security" (from requests[security]==2.18.4->bittrex-websocket==0.0.7.2)
Downloading cryptography-2.2.2.tar.gz (443kB)
Collecting pyOpenSSL>=0.14; extra == "security" (from requests[security]==2.18.4->bittrex-websocket==0.0.7.2)
Downloading pyOpenSSL-17.5.0-py2.py3-none-any.whl (53kB)
Collecting six (from websocket-client>=0.47.0->bittrex-websocket==0.0.7.2)
Downloading six-1.11.0-py2.py3-none-any.whl
Collecting greenlet>=0.4.13 (from gevent>=1.3a1->bittrex-websocket==0.0.7.2)
Downloading greenlet-0.4.13.tar.gz (58kB)
Collecting sseclient (from signalr-client-slazarov==0.0.7.2->bittrex-websocket==0.0.7.2)
Downloading sseclient-0.0.19.tar.gz
Collecting asn1crypto>=0.21.0 (from cryptography>=1.3.4; extra == "security"->requests[security]==2.18.4->bittrex-websocket==0.0.7.2)
Downloading asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
Collecting cffi>=1.7 (from cryptography>=1.3.4; extra == "security"->requests[security]==2.18.4->bittrex-websocket==0.0.7.2)
Downloading cffi-1.11.5.tar.gz (438kB)
Collecting pycparser (from cffi>=1.7->cryptography>=1.3.4; extra == "security"->requests[security]==2.18.4->bittrex-websocket==0.0.7.2)
Downloading pycparser-2.18.tar.gz (245kB)
Building wheels for collected packages: cfscrape, Events, gevent, PyExecJS, cryptography, greenlet, sseclient, cffi, pycparser
Running setup.py bdist_wheel for cfscrape: started
Running setup.py bdist_wheel for cfscrape: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/dd/71/cb/4003c20f6260d90eef9d582dc235dc25b4137b68ac48969795
Running setup.py bdist_wheel for Events: started
Running setup.py bdist_wheel for Events: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/4a/ef/51/8cbed0cc4f0b271ac88e63b24505d6693afd95129d63e63810
Running setup.py bdist_wheel for gevent: started
Running setup.py bdist_wheel for gevent: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/db/c4/08/5b6e86d3d33138bd1dfe1d06dac6fbc0b0695519f567a6af49
Running setup.py bdist_wheel for PyExecJS: started
Running setup.py bdist_wheel for PyExecJS: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/9a/bb/54/8d217dc123fd0bbf97db02b002f9a5e8a5f4f74b79f756f064
Running setup.py bdist_wheel for cryptography: started
Running setup.py bdist_wheel for cryptography: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/c0/71/36/8d0382ddc11aff7dd3b3ccc626f13291b66050da1728412128
Running setup.py bdist_wheel for greenlet: started
Running setup.py bdist_wheel for greenlet: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/ac/03/1c/645330f4cf8dd406adb2ea80dc50adc1ee30bab15e5b30693b
Running setup.py bdist_wheel for sseclient: started
Running setup.py bdist_wheel for sseclient: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/6c/7c/e6/3e19b6312eaa449622b22dd551052b8f077caacd265812c868
Running setup.py bdist_wheel for cffi: started
Running setup.py bdist_wheel for cffi: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/6e/3e/ea/7c7a81e010f9ca4f1ee3ebf1005f316612274e3e44f90a5ada
Running setup.py bdist_wheel for pycparser: started
Running setup.py bdist_wheel for pycparser: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/95/14/9a/5e7b9024459d2a6600aaa64e0ba485325aff7a9ac7489db1b6
Successfully built cfscrape Events gevent PyExecJS cryptography greenlet sseclient cffi pycparser
Installing collected packages: six, PyExecJS, urllib3, chardet, certifi, idna, asn1crypto, pycparser, cffi, cryptography, pyOpenSSL, requests, cfscrape, Events, websocket-client, greenlet, gevent, sseclient, signalr-client-slazarov, bittrex-websocket
Running setup.py install for bittrex-websocket: started
Running setup.py install for bittrex-websocket: finished with status 'done'
Successfully installed Events-0.3 PyExecJS-1.5.1 asn1crypto-0.24.0 bittrex-websocket-0.0.7.2 certifi-2018.1.18 cffi-1.11.5 cfscrape-1.9.4 chardet-3.0.4 cryptography-2.2.2 gevent-1.3a2 greenlet-0.4.13 idna-2.6 pyOpenSSL-17.5.0 pycparser-2.18 requests-2.18.4 signalr-client-slazarov-0.0.7.2 six-1.11.0 sseclient-0.0.19 urllib3-1.22 websocket-client-0.47.0
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(1/23) Purging .build-deps (0)
(2/23) Purging g++ (5.3.0-r0)
(3/23) Purging gcc (5.3.0-r0)
(4/23) Purging binutils (2.26-r1)
(5/23) Purging isl (0.14.1-r0)
(6/23) Purging libatomic (5.3.0-r0)
(7/23) Purging libc-dev (0.7-r0)
(8/23) Purging musl-dev (1.1.14-r16)
(9/23) Purging make (4.1-r1)
(10/23) Purging libffi-dev (3.2.1-r2)
(11/23) Purging openssl-dev (1.0.2n-r0)
(12/23) Purging zlib-dev (1.2.11-r0)
(13/23) Purging pkgconfig (0.25-r1)
(14/23) Purging pkgconf (0.9.12-r0)
(15/23) Purging git (2.8.6-r0)
(16/23) Purging binutils-libs (2.26-r1)
(17/23) Purging mpc1 (1.0.3-r0)
(18/23) Purging mpfr3 (3.1.2-r0)
(19/23) Purging gmp (6.1.0-r0)
(20/23) Purging libgomp (5.3.0-r0)
(21/23) Purging libcurl (7.59.0-r0)
(22/23) Purging libssh2 (1.7.0-r0)
(23/23) Purging pcre (8.38-r1)
Executing busybox-1.24.2-r13.trigger
OK: 67 MiB in 38 packages
Removing intermediate container 3ca5eaf40183
---> f316a24d67a6
Step 3/5 : WORKDIR /app
Removing intermediate container a326c26c8fa5
---> db0b122de814
Step 4/5 : ADD . /app
---> e2a8b6f04ec6
Step 5/5 : CMD ["python", "example.py"]
---> Running in deeb0241f86a
Removing intermediate container deeb0241f86a
---> cb5f4e35a3c9
Successfully built cb5f4e35a3c9
Successfully tagged bittrex_socket:latest

Run

We are fully synced. Hooray!
Ticker: BTC-ETH, Bids depth 0: 13.01476089@0.05764786
Ticker: BTC-NEO, Bids depth 0: 5.02320029@0.00738695
Ticker: BTC-ZEC, Bids depth 0: 0.49089876@0.02748505
Ticker: ETH-NEO, Bids depth 0: 4.92846628@0.12750007
Ticker: ETH-ZEC, Bids depth 0: 36.72@0.47522621

Code has been rewritten, reopen if you still get the issue.