# Buggy code
def load_strategy(config: Optional[Dict] = None) -> IStrategy:
    """
    Load the custom class from config parameter
    :param config: configuration dictionary or None
    """
    config = config or {}

    if not config.get("strategy"):
        raise OperationalException(
            "No strategy set. Please use `--strategy` to specify "
            "the strategy class to use."
        )

    strategy_name = config["strategy"]
    strategy: IStrategy = StrategyResolver._load_strategy(
        strategy_name, config=config, extra_dir=config.get("strategy_path")
    )

    # make sure ask_strategy dict is available
    if "ask_strategy" not in config:
        config["ask_strategy"] = {}

    # Set attributes
    # Check if we need to override configuration
    #             (Attribute name,                    default,     ask_strategy)
    attributes = [
        ("minimal_roi", {"0": 10.0}, False),
        ("ticker_interval", None, False),
        ("stoploss", None, False),
        ("trailing_stop", None, False),
        ("trailing_stop_positive", None, False),
        ("trailing_stop_positive_offset", 0.0, False),
        ("trailing_only_offset_is_reached", None, False),
        ("process_only_new_candles", None, False),
        ("order_types", None, False),
        ("order_time_in_force", None, False),
        ("stake_currency", None, False),
        ("stake_amount", None, False),
        ("startup_candle_count", None, False),
        ("unfilledtimeout", None, False),
        ("use_sell_signal", True, True),
        ("sell_profit_only", False, True),
        ("ignore_roi_if_buy_signal", False, True),
    ]
    for attribute, default, ask_strategy in attributes:
        if ask_strategy:
            StrategyResolver._override_attribute_helper(
                strategy, config["ask_strategy"], attribute, default
            )
        else:
            StrategyResolver._override_attribute_helper(
                strategy, config, attribute, default
            )

    # Loop this list again to have output combined
    for attribute, _, exp in attributes:
        if exp and attribute in config["ask_strategy"]:
            logger.info(
                "Strategy using %s: %s", attribute, config["ask_strategy"][attribute]
            )
        elif attribute in config:
            logger.info("Strategy using %s: %s", attribute, config[attribute])

    # Sort and apply type conversions
    strategy.minimal_roi = OrderedDict(
        sorted(
            {int(key): value for (key, value) in strategy.minimal_roi.items()}.items(),
            key=lambda t: t[0],
        )
    )
    strategy.stoploss = float(strategy.stoploss)

    StrategyResolver._strategy_sanity_validations(strategy)
    return strategy


# Traceback (Exception)
2020-02-20 22:47:28,025 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):
File "/opt/tradebot/freqtrade/.env/lib/python3.7/site-packages/talib/__init__.py", line 20, in wrapper
for arg in chain(args, kwargs.values())
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/freqtrade/freqtrade/main.py", line 36, in main
return_code = args['func'](args)
File "/freqtrade/freqtrade/commands/optimize_commands.py", line 76, in start_hyperopt
hyperopt.start()
File "/freqtrade/freqtrade/optimize/hyperopt.py", line 488, in start
preprocessed = self.backtesting.strategy.tickerdata_to_dataframe(data)
File "/freqtrade/freqtrade/strategy/interface.py", line 448, in tickerdata_to_dataframe
for pair, pair_data in tickerdata.items()}
File "/freqtrade/freqtrade/strategy/interface.py", line 448, in <dictcomp>
for pair, pair_data in tickerdata.items()}
File "/freqtrade/freqtrade/strategy/interface.py", line 464, in advise_indicators
return self.populate_indicators(dataframe, metadata)
File "/freqtrade/user_data/strategies/MyDev.py", line 205, in populate_indicators
dataframe['mfi'] = ta.MFI(dataframe)
File "talib/_abstract.pxi", line 352, in talib._ta_lib.Function.__call__
File "talib/_abstract.pxi", line 383, in talib._ta_lib.Function.__call_function
File "/opt/tradebot/freqtrade/.env/lib/python3.7/site-packages/talib/__init__.py", line 24, in wrapper
return func(*args, **kwargs)
File "talib/_func.pxi", line 8454, in talib._ta_lib.MFI
Exception: volume is not double

# Fixed code
def load_strategy(config: Dict[str, Any] = None) -> IStrategy:
    """
    Load the custom class from config parameter
    :param config: configuration dictionary or None
    """
    config = config or {}

    if not config.get("strategy"):
        raise OperationalException(
            "No strategy set. Please use `--strategy` to specify "
            "the strategy class to use."
        )

    strategy_name = config["strategy"]
    strategy: IStrategy = StrategyResolver._load_strategy(
        strategy_name, config=config, extra_dir=config.get("strategy_path")
    )

    # make sure ask_strategy dict is available
    if "ask_strategy" not in config:
        config["ask_strategy"] = {}

    # Set attributes
    # Check if we need to override configuration
    #             (Attribute name,                    default,     ask_strategy)
    attributes = [
        ("minimal_roi", {"0": 10.0}, False),
        ("ticker_interval", None, False),
        ("stoploss", None, False),
        ("trailing_stop", None, False),
        ("trailing_stop_positive", None, False),
        ("trailing_stop_positive_offset", 0.0, False),
        ("trailing_only_offset_is_reached", None, False),
        ("process_only_new_candles", None, False),
        ("order_types", None, False),
        ("order_time_in_force", None, False),
        ("stake_currency", None, False),
        ("stake_amount", None, False),
        ("startup_candle_count", None, False),
        ("unfilledtimeout", None, False),
        ("use_sell_signal", True, True),
        ("sell_profit_only", False, True),
        ("ignore_roi_if_buy_signal", False, True),
    ]
    for attribute, default, ask_strategy in attributes:
        if ask_strategy:
            StrategyResolver._override_attribute_helper(
                strategy, config["ask_strategy"], attribute, default
            )
        else:
            StrategyResolver._override_attribute_helper(
                strategy, config, attribute, default
            )

    # Loop this list again to have output combined
    for attribute, _, exp in attributes:
        if exp and attribute in config["ask_strategy"]:
            logger.info(
                "Strategy using %s: %s", attribute, config["ask_strategy"][attribute]
            )
        elif attribute in config:
            logger.info("Strategy using %s: %s", attribute, config[attribute])

    # Sort and apply type conversions
    strategy.minimal_roi = OrderedDict(
        sorted(
            {int(key): value for (key, value) in strategy.minimal_roi.items()}.items(),
            key=lambda t: t[0],
        )
    )
    strategy.stoploss = float(strategy.stoploss)

    StrategyResolver._strategy_sanity_validations(strategy)
    return strategy