# Buggy code
def stoploss_limit(
    self, pair: str, amount: float, stop_price: float, rate: float
) -> Dict:
    """
    creates a stoploss limit order.
    NOTICE: it is not supported by all exchanges. only binance is tested for now.
    TODO: implementation maybe needs to be moved to the binance subclass
    """
    ordertype = "stop_loss_limit"

    stop_price = self.symbol_price_prec(pair, stop_price)

    # Ensure rate is less than stop price
    if stop_price <= rate:
        raise OperationalException(
            "In stoploss limit order, stop price should be more than limit price"
        )

    if self._config["dry_run"]:
        dry_order = self.dry_run_order(pair, ordertype, "sell", amount, stop_price)
        return dry_order

    params = self._params.copy()
    params.update({"stopPrice": stop_price})

    order = self.create_order(pair, ordertype, "sell", amount, rate, params)
    logger.info(
        "stoploss limit order added for %s. "
        "stop price: %s. limit: %s" % (pair, stop_price, rate)
    )
    return order


# Traceback (requests.exceptions.HTTPError)
2019-07-11 07:38:02,780 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 526, in fetch
response.raise_for_status()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.binance.com/api/v3/order

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/freqtrade/freqtrade/exchange/exchange.py", line 370, in create_order
amount, rate, params)
File "/usr/local/lib/python3.7/site-packages/ccxt/binance.py", line 703, in create_order
response = getattr(self, method)(self.extend(request, params))
File "/usr/local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 421, in inner
return entry(_self, **inner_kwargs)
File "/usr/local/lib/python3.7/site-packages/ccxt/binance.py", line 1226, in request
response = self.fetch2(path, api, method, params, headers, body)
File "/usr/local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 446, in fetch2
return self.fetch(request['url'], request['method'], request['headers'], request['body'])
File "/usr/local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 538, in fetch
self.handle_errors(response.status_code, response.reason, url, method, headers, http_response, json_response)
File "/usr/local/lib/python3.7/site-packages/ccxt/binance.py", line 1219, in handle_errors
raise exceptions[error](self.id + ' ' + body)
ccxt.base.errors.InvalidOrder: binance {"code":-1013,"msg":"Filter failure: MIN_NOTIONAL"}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/freqtrade/freqtrade/main.py", line 52, in main
worker.run()
File "/freqtrade/freqtrade/worker.py", line 72, in run
state = self._worker(old_state=state)
File "/freqtrade/freqtrade/worker.py", line 110, in _worker
self._throttle(func=self._process, min_secs=throttle_secs)
File "/freqtrade/freqtrade/worker.py", line 123, in _throttle
result = func(*args, **kwargs)
File "/freqtrade/freqtrade/worker.py", line 133, in _process
state_changed = self.freqtrade.process()
File "/freqtrade/freqtrade/freqtradebot.py", line 136, in process
state_changed |= self.process_maybe_execute_sell(trade)
File "/freqtrade/freqtrade/freqtradebot.py", line 459, in process_maybe_execute_sell
result = self.handle_trade(trade)
File "/freqtrade/freqtrade/freqtradebot.py", line 596, in handle_trade
if self.check_sell(trade, sell_rate, buy, sell):
File "/freqtrade/freqtrade/freqtradebot.py", line 711, in check_sell
self.execute_sell(trade, sell_rate, should_sell.sell_type)
File "/freqtrade/freqtrade/freqtradebot.py", line 852, in execute_sell
time_in_force=self.strategy.order_time_in_force['sell']
File "/freqtrade/freqtrade/exchange/exchange.py", line 412, in sell
return self.create_order(pair, ordertype, 'sell', amount, rate, params)
File "/freqtrade/freqtrade/exchange/exchange.py", line 379, in create_order
f'Could not create {ordertype} {side} order on market {pair}.'
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

# Fixed code
def stoploss_limit(
    self, pair: str, amount: float, stop_price: float, rate: float
) -> Dict:
    """
    creates a stoploss limit order.
    NOTICE: it is not supported by all exchanges. only binance is tested for now.
    TODO: implementation maybe needs to be moved to the binance subclass
    """
    ordertype = "stop_loss_limit"

    stop_price = self.symbol_price_prec(pair, stop_price)

    # Ensure rate is less than stop price
    if stop_price <= rate:
        raise OperationalException(
            "In stoploss limit order, stop price should be more than limit price"
        )

    if self._config["dry_run"]:
        dry_order = self.dry_run_order(pair, ordertype, "sell", amount, stop_price)
        return dry_order

    params = self._params.copy()
    params.update({"stopPrice": stop_price})

    order = self.create_order(pair, ordertype, "sell", amount, rate, params)
    logger.info(
        "stoploss limit order added for %s. stop price: %s. limit: %s",
        pair,
        stop_price,
        rate,
    )
    return order