# Buggy code
def start_download_data(args: Dict[str, Any]) -> None:
    """
    Download data (former download_backtest_data.py script)
    """
    config = setup_utils_configuration(args, RunMode.OTHER)

    timerange = TimeRange()
    if "days" in config:
        time_since = arrow.utcnow().shift(days=-config["days"]).strftime("%Y%m%d")
        timerange = TimeRange.parse_timerange(f"{time_since}-")

    dl_path = Path(config["datadir"])
    logger.info(
        f"About to download pairs: {config['pairs']}, "
        f"intervals: {config['timeframes']} to {dl_path}"
    )

    pairs_not_available: List[str] = []

    try:
        # Init exchange
        exchange = ExchangeResolver(config["exchange"]["name"], config).exchange

        pairs_not_available = refresh_backtest_ohlcv_data(
            exchange,
            pairs=config["pairs"],
            timeframes=config["timeframes"],
            dl_path=Path(config["datadir"]),
            timerange=timerange,
            erase=config.get("erase"),
        )

    except KeyboardInterrupt:
        sys.exit("SIGINT received, aborting ...")

    finally:
        if pairs_not_available:
            logger.info(
                f"Pairs [{','.join(pairs_not_available)}] not available "
                f"on exchange {config['exchange']['name']}."
            )


# Traceback (KeyError)
(.env) user@nuc:~/freqtrade-wrk/github-hroff-1902/freqtrade$ freqtrade download-data --exchange bittrex
2019-09-06 01:00:15,176 - freqtrade.loggers - INFO - Verbosity set to 0
2019-09-06 01:00:15,177 - freqtrade.configuration.configuration - INFO - Dry run is enabled
2019-09-06 01:00:15,177 - freqtrade.configuration.configuration - INFO - Using DB: "sqlite://"
2019-09-06 01:00:15,177 - freqtrade.configuration.configuration - INFO - Using max_open_trades: None ...
2019-09-06 01:00:15,177 - freqtrade.configuration.configuration - INFO - Using exchange bittrex
2019-09-06 01:00:15,178 - freqtrade.configuration.configuration - INFO - Using user-data directory: /home/user/freqtrade-wrk/github-hroff-1902/freqtrade/user_data ...
2019-09-06 01:00:15,178 - freqtrade.configuration.configuration - INFO - Using data directory: /home/user/freqtrade-wrk/github-hroff-1902/freqtrade/user_data/data/bittrex ...
2019-09-06 01:00:15,178 - freqtrade.configuration.configuration - INFO - timeframes --timeframes: ['1m', '5m']
2019-09-06 01:00:15,178 - freqtrade.configuration.check_exchange - INFO - Checking exchange...
2019-09-06 01:00:15,178 - freqtrade.configuration.check_exchange - INFO - Exchange "bittrex" is officially supported by the Freqtrade development team.
2019-09-06 01:00:15,179 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):
File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/main.py", line 40, in main
args.func(args)
File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/utils.py", line 75, in start_download_data
logger.info(f'About to download pairs: {config["pairs"]}, '
KeyError: 'pairs'

# Fixed code
def start_download_data(args: Dict[str, Any]) -> None:
    """
    Download data (former download_backtest_data.py script)
    """
    config = setup_utils_configuration(args, RunMode.OTHER)

    timerange = TimeRange()
    if "days" in config:
        time_since = arrow.utcnow().shift(days=-config["days"]).strftime("%Y%m%d")
        timerange = TimeRange.parse_timerange(f"{time_since}-")

    if "pairs" not in config:
        raise OperationalException(
            "Downloading data requires a list of pairs. "
            "Please check the documentation on how to configure this."
        )

    dl_path = Path(config["datadir"])
    logger.info(
        f"About to download pairs: {config['pairs']}, "
        f"intervals: {config['timeframes']} to {dl_path}"
    )

    pairs_not_available: List[str] = []

    try:
        # Init exchange
        exchange = ExchangeResolver(config["exchange"]["name"], config).exchange

        pairs_not_available = refresh_backtest_ohlcv_data(
            exchange,
            pairs=config["pairs"],
            timeframes=config["timeframes"],
            dl_path=Path(config["datadir"]),
            timerange=timerange,
            erase=config.get("erase"),
        )

    except KeyboardInterrupt:
        sys.exit("SIGINT received, aborting ...")

    finally:
        if pairs_not_available:
            logger.info(
                f"Pairs [{','.join(pairs_not_available)}] not available "
                f"on exchange {config['exchange']['name']}."
            )