# Buggy code
def init(config: dict) -> None:
    """
    Initializes this module with the given config,
    registers all known command handlers
    and starts polling for message updates
    :param config: config to use
    :return: None
    """
    global _UPDATER

    _CONF.update(config)
    if not is_enabled():
        return

    _UPDATER = Updater(token=config["telegram"]["token"], workers=0)

    # Register command handler and start telegram message polling
    handles = [
        CommandHandler("status", _status),
        CommandHandler("profit", _profit),
        CommandHandler("balance", _balance),
        CommandHandler("start", _start),
        CommandHandler("stop", _stop),
        CommandHandler("forcesell", _forcesell),
        CommandHandler("performance", _performance),
        CommandHandler("count", _count),
        CommandHandler("help", _help),
        CommandHandler("version", _version),
    ]
    for handle in handles:
        _UPDATER.dispatcher.add_handler(handle)
    _UPDATER.start_polling(
        clean=True,
        bootstrap_retries=3,
        timeout=30,
        read_latency=60,
    )
    logger.info(
        "rpc.telegram is listening for following commands: %s",
        [h.command for h in handles],
    )


# Traceback (telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError)
2017-11-17 10:22:05,893 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
2017-11-17 10:22:11,311 - freqtrade - INFO - *BITTREX:* Buying [BTC/RLC](https://www.bittrex.com/Market/Index?MarketName=BTC-RLC) with limit `0.00006956`
2017-11-17 10:22:16,619 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
raise value
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
exc_cls=ReadTimeoutError)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./freqtrade/main.py", line 361, in <module>
main()
File "./freqtrade/main.py", line 355, in main
dynamic_whitelist=args.dynamic_whitelist,
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/misc.py", line 52, in throttle
result = func(*args, **kwargs)
File "./freqtrade/main.py", line 70, in _process
trade = create_trade(float(_CONF['stake_amount']))
File "./freqtrade/main.py", line 243, in create_trade
telegram.send_msg(message)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
result = func(self, *args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
raise TimedOut()
telegram.error.TimedOut: Timed out
2017-11-17 11:15:03,507 - freqtrade.rpc.telegram - INFO - Executing handler: _status for chat_id: 497298357
2017-11-17 11:15:08,839 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
2017-11-17 11:15:14,141 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
raise value
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
exc_cls=ReadTimeoutError)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
return command_handler(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 132, in _status
send_msg('*Status:* `no active trade`', bot=bot)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
result = func(self, *args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
raise TimedOut()
telegram.error.TimedOut: Timed out
2017-11-17 11:15:22,760 - freqtrade.rpc.telegram - INFO - Executing handler: _profit for chat_id: 497298357
2017-11-17 11:15:28,551 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
2017-11-17 11:15:33,857 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
raise value
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
exc_cls=ReadTimeoutError)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
return command_handler(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 267, in _profit
send_msg(markdown_msg, bot=bot)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
result = func(self, *args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
raise TimedOut()
telegram.error.TimedOut: Timed out
2017-11-17 11:15:36,685 - freqtrade.rpc.telegram - INFO - Executing handler: _performance for chat_id: 497298357
2017-11-17 11:15:41,984 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
2017-11-17 11:15:47,300 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
raise value
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
exc_cls=ReadTimeoutError)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
return command_handler(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 390, in _performance
send_msg(message, parse_mode=ParseMode.HTML)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
result = func(self, *args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
raise TimedOut()
telegram.error.TimedOut: Timed out
2017-11-17 11:35:05,494 - freqtrade.rpc.telegram - INFO - Executing handler: _status for chat_id: 497298357
2017-11-17 11:35:10,811 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
2017-11-17 11:35:16,109 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
raise value
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
exc_cls=ReadTimeoutError)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
return command_handler(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 132, in _status
send_msg('*Status:* `no active trade`', bot=bot)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
result = func(self, *args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
raise TimedOut()
telegram.error.TimedOut: Timed out
2017-11-17 11:35:17,780 - freqtrade.rpc.telegram - INFO - Executing handler: _profit for chat_id: 497298357
2017-11-17 11:35:23,091 - freqtrade.rpc.telegram - WARNING - Got Telegram NetworkError: Timed out! Trying one more time.
2017-11-17 11:35:28,421 - freqtrade.rpc.telegram - ERROR - Exception occurred within Telegram module
Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 190, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise
raise value
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
exc_cls=ReadTimeoutError)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 104, in wrapper
return command_handler(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 267, in _profit
send_msg(markdown_msg, bot=bot)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/rpc/telegram.py", line 487, in send_msg
bot.send_message(_CONF['telegram']['chat_id'], msg, parse_mode=parse_mode)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 57, in decorator
result = func(self, *args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/bot.py", line 82, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
raise TimedOut()
telegram.error.TimedOut: Timed out

# Fixed code
def init(config: dict) -> None:
    """
    Initializes this module with the given config,
    registers all known command handlers
    and starts polling for message updates
    :param config: config to use
    :return: None
    """
    global _UPDATER

    _CONF.update(config)
    if not is_enabled():
        return

    _UPDATER = Updater(token=config["telegram"]["token"], workers=0)

    # Register command handler and start telegram message polling
    handles = [
        CommandHandler("status", _status),
        CommandHandler("profit", _profit),
        CommandHandler("balance", _balance),
        CommandHandler("start", _start),
        CommandHandler("stop", _stop),
        CommandHandler("forcesell", _forcesell),
        CommandHandler("performance", _performance),
        CommandHandler("count", _count),
        CommandHandler("help", _help),
        CommandHandler("version", _version),
    ]
    for handle in handles:
        _UPDATER.dispatcher.add_handler(handle)
    _UPDATER.start_polling(
        clean=True,
        bootstrap_retries=-1,
        timeout=30,
        read_latency=60,
    )
    logger.info(
        "rpc.telegram is listening for following commands: %s",
        [h.command for h in handles],
    )