# Buggy code
def create_order(
    self,
    pair: str,
    ordertype: str,
    side: str,
    amount: float,
    rate: float,
    params: Dict = {},
) -> Dict:
    try:
        # Set the precision for amount and price(rate) as accepted by the exchange
        amount = self.symbol_amount_prec(pair, amount)
        needs_price = ordertype != "market" or self._api.options.get(
            "createMarketBuyOrderRequiresPrice", False
        )
        rate = self.symbol_price_prec(pair, rate) if needs_price else None

        return self._api.create_order(pair, ordertype, side, amount, rate, params)

    except ccxt.InsufficientFunds as e:
        raise DependencyException(
            f"Insufficient funds to create {ordertype} {side} order on market {pair}."
            f"Tried to {side} amount {amount} at rate {rate} (total {rate * amount})."
            f"Message: {e}"
        ) from e
    except ccxt.InvalidOrder as e:
        raise DependencyException(
            f"Could not create {ordertype} {side} order on market {pair}."
            f"Tried to {side} amount {amount} at rate {rate} (total {rate * amount})."
            f"Message: {e}"
        ) from e
    except (ccxt.NetworkError, ccxt.ExchangeError) as e:
        raise TemporaryError(
            f"Could not place {side} order due to {e.__class__.__name__}. Message: {e}"
        ) from e
    except ccxt.BaseError as e:
        raise OperationalException(e) from e


# 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 create_order(
    self,
    pair: str,
    ordertype: str,
    side: str,
    amount: float,
    rate: float,
    params: Dict = {},
) -> Dict:
    try:
        # Set the precision for amount and price(rate) as accepted by the exchange
        amount = self.symbol_amount_prec(pair, amount)
        needs_price = ordertype != "market" or self._api.options.get(
            "createMarketBuyOrderRequiresPrice", False
        )
        rate = self.symbol_price_prec(pair, rate) if needs_price else None

        return self._api.create_order(pair, ordertype, side, amount, rate, params)

    except ccxt.InsufficientFunds as e:
        raise DependencyException(
            f"Insufficient funds to create {ordertype} {side} order on market {pair}."
            f"Tried to {side} amount {amount} at rate {rate}."
            f"Message: {e}"
        ) from e
    except ccxt.InvalidOrder as e:
        raise DependencyException(
            f"Could not create {ordertype} {side} order on market {pair}."
            f"Tried to {side} amount {amount} at rate {rate}."
            f"Message: {e}"
        ) from e
    except (ccxt.NetworkError, ccxt.ExchangeError) as e:
        raise TemporaryError(
            f"Could not place {side} order due to {e.__class__.__name__}. Message: {e}"
        ) from e
    except ccxt.BaseError as e:
        raise OperationalException(e) from e