# Buggy code
def __init__(self, config: Dict[str, Any]) -> None:
    """
    Init all variables and objects the bot needs to work
    :param config: configuration dict, you can use Configuration.get_config()
    to get the config dict.
    """

    logger.info("Starting freqtrade %s", __version__)

    # Init bot state
    self.state = State.STOPPED

    # Init objects
    self.config = config

    self._heartbeat_msg = 0

    self.heartbeat_interval = self.config.get("internals", {}).get(
        "heartbeat_interval", 60
    )

    self.strategy: IStrategy = StrategyResolver.load_strategy(self.config)

    # Check config consistency here since strategies can set certain options
    validate_config_consistency(config)

    self.exchange = ExchangeResolver.load_exchange(
        self.config["exchange"]["name"], self.config
    )

    persistence.init(
        self.config.get("db_url", None), clean_open_orders=self.config["dry_run"]
    )

    self.wallets = Wallets(self.config, self.exchange)

    self.dataprovider = DataProvider(self.config, self.exchange)

    # Attach Dataprovider to Strategy baseclass
    IStrategy.dp = self.dataprovider
    # Attach Wallets to Strategy baseclass
    IStrategy.wallets = self.wallets

    self.pairlists = PairListManager(self.exchange, self.config)

    # Initializing Edge only if enabled
    self.edge = (
        Edge(self.config, self.exchange, self.strategy)
        if self.config.get("edge", {}).get("enabled", False)
        else None
    )

    self.active_pair_whitelist = self._refresh_whitelist()

    # Set initial bot state from config
    initial_state = self.config.get("initial_state")
    self.state = State[initial_state.upper()] if initial_state else State.STOPPED

    # RPC runs in separate threads, can start handling external commands just after
    # initialization, even before Freqtradebot has a chance to start its throttling,
    # so anything in the Freqtradebot instance should be ready (initialized), including
    # the initial state of the bot.
    # Keep this at the end of this initialization method.
    self.rpc: RPCManager = RPCManager(self)
    # Protect sell-logic from forcesell and viceversa
    self._sell_lock = Lock()


# 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 __init__(self, config: Dict[str, Any]) -> None:
    """
    Init all variables and objects the bot needs to work
    :param config: configuration dict, you can use Configuration.get_config()
    to get the config dict.
    """

    logger.info("Starting freqtrade %s", __version__)

    # Init bot state
    self.state = State.STOPPED

    # Init objects
    self.config = config

    self._sell_rate_cache = TTLCache(maxsize=100, ttl=5)
    self._buy_rate_cache = TTLCache(maxsize=100, ttl=5)

    self.strategy: IStrategy = StrategyResolver.load_strategy(self.config)

    # Check config consistency here since strategies can set certain options
    validate_config_consistency(config)

    self.exchange = ExchangeResolver.load_exchange(
        self.config["exchange"]["name"], self.config
    )

    persistence.init(
        self.config.get("db_url", None), clean_open_orders=self.config["dry_run"]
    )

    self.wallets = Wallets(self.config, self.exchange)

    self.dataprovider = DataProvider(self.config, self.exchange)

    # Attach Dataprovider to Strategy baseclass
    IStrategy.dp = self.dataprovider
    # Attach Wallets to Strategy baseclass
    IStrategy.wallets = self.wallets

    self.pairlists = PairListManager(self.exchange, self.config)

    # Initializing Edge only if enabled
    self.edge = (
        Edge(self.config, self.exchange, self.strategy)
        if self.config.get("edge", {}).get("enabled", False)
        else None
    )

    self.active_pair_whitelist = self._refresh_whitelist()

    # Set initial bot state from config
    initial_state = self.config.get("initial_state")
    self.state = State[initial_state.upper()] if initial_state else State.STOPPED

    # RPC runs in separate threads, can start handling external commands just after
    # initialization, even before Freqtradebot has a chance to start its throttling,
    # so anything in the Freqtradebot instance should be ready (initialized), including
    # the initial state of the bot.
    # Keep this at the end of this initialization method.
    self.rpc: RPCManager = RPCManager(self)
    # Protect sell-logic from forcesell and viceversa
    self._sell_lock = Lock()