# Buggy code
def get_ticker_history(self, pair: str, tick_interval: int) -> List[Dict]:
    if tick_interval == 1:
        interval = "oneMin"
    elif tick_interval == 5:
        interval = "fiveMin"
    else:
        raise ValueError("Cannot parse tick_interval: {}".format(tick_interval))

    data = _API_V2.get_candles(pair.replace("_", "-"), interval)
    # This sanity check is necessary because bittrex returns nonsense sometimes
    for prop in ["C", "V", "O", "H", "L", "T"]:
        for tick in data["result"]:
            if prop not in tick.keys():
                logger.warning("Required property %s not present in response", prop)
                return []

    if not data["success"]:
        raise RuntimeError(
            "{message} params=({pair})".format(message=data["message"], pair=pair)
        )

    return data["result"]


# Traceback (TypeError)
2017-11-15 00:48:38,788 - freqtrade - INFO - Checked all whitelisted currencies. Found no suitable entry positions for buying. Will keep looking ...
2017-11-15 00:48:48,267 - freqtrade - INFO - Checking buy signals to create a new trade with stake_amount: 0.050000 ...
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 223, in create_trade
if get_buy_signal(_pair):
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/analyze.py", line 99, in get_buy_signal
dataframe = analyze_ticker(pair)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/analyze.py", line 82, in analyze_ticker
ticker_hist = get_ticker_history(pair)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/.env/lib/python3.6/site-packages/cachetools/__init__.py", line 46, in wrapper
v = func(*args, **kwargs)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/exchange/__init__.py", line 133, in get_ticker_history
return _API.get_ticker_history(pair, tick_interval)
File "/Users/sgrimm/dev/cryptos/bots/freqtrade/freqtrade/exchange/bittrex.py", line 106, in get_ticker_history
for tick in data['result']:
TypeError: 'NoneType' object is not iterable

# Fixed code
def get_ticker_history(self, pair: str, tick_interval: int) -> List[Dict]:
    if tick_interval == 1:
        interval = "oneMin"
    elif tick_interval == 5:
        interval = "fiveMin"
    else:
        raise ValueError("Cannot parse tick_interval: {}".format(tick_interval))

    data = _API_V2.get_candles(pair.replace("_", "-"), interval)

    # These sanity check are necessary because bittrex cannot keep their API stable.
    if not data.get("result"):
        return []

    for prop in ["C", "V", "O", "H", "L", "T"]:
        for tick in data["result"]:
            if prop not in tick.keys():
                logger.warning("Required property %s not present in response", prop)
                return []

    if not data["success"]:
        raise RuntimeError(
            "{message} params=({pair})".format(message=data["message"], pair=pair)
        )

    return data["result"]