# Buggy code
def handle_trailing_stoploss_on_exchange(self, trade: Trade, order):
    """
    Check to see if stoploss on exchange should be updated
    in case of trailing stoploss on exchange
    :param Trade: Corresponding Trade
    :param order: Current on exchange stoploss order
    :return: None
    """

    if trade.stop_loss > float(order["info"]["stopPrice"]):
        # we check if the update is neccesary
        update_beat = self.strategy.order_types.get("stoploss_on_exchange_interval", 60)
        if (
            datetime.utcnow() - trade.stoploss_last_update
        ).total_seconds() > update_beat:
            # cancelling the current stoploss on exchange first
            logger.info(
                "Trailing stoploss: cancelling current stoploss on exchange (id:{%s})"
                "in order to add another one ...",
                order["id"],
            )
            if self.exchange.cancel_order(order["id"], trade.pair):
                # creating the new one
                stoploss_order_id = self.exchange.stoploss_limit(
                    pair=trade.pair,
                    amount=trade.amount,
                    stop_price=trade.stop_loss,
                    rate=trade.stop_loss * 0.99,
                )["id"]
                trade.stoploss_order_id = str(stoploss_order_id)


# Traceback (requests.exceptions.HTTPError)
2019-06-14 04:49:15,977 - freqtrade.rpc.rpc_manager - INFO - Cleaning up rpc modules ...
2019-06-14 04:49:18,474 - freqtrade.configuration - INFO - Verbosity set to 0
2019-06-14 04:49:18,475 - freqtrade.configuration - INFO - Dry run is disabled
2019-06-14 04:49:18,475 - freqtrade.configuration - WARNING - `forcebuy` RPC message enabled.
2019-06-14 04:49:18,475 - freqtrade.configuration - INFO - Using DB: "sqlite:///binancegobble.sqlite"
2019-06-14 04:49:18,475 - freqtrade.configuration - INFO - Using max_open_trades: 50 ...
2019-06-14 04:49:18,475 - freqtrade.configuration - INFO - Using data folder: user_data/data/binance ...
2019-06-14 04:49:18,476 - freqtrade.freqtradebot - INFO - Starting freqtrade 0.18.5-dev
2019-06-14 04:49:18,477 - freqtrade.resolvers.strategy_resolver - INFO - Using resolved strategy strategy from '/home/dante/freqtrade/user_data/strategies'
2019-06-14 04:49:18,477 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_currency' with value in config file: BTC.
2019-06-14 04:49:18,477 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_amount' with value in config file: 0.01.
2019-06-14 04:49:18,478 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'use_sell_signal' with value in config file: True.
2019-06-14 04:49:18,478 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'sell_profit_only' with value in config file: False.
2019-06-14 04:49:18,478 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'ignore_roi_if_buy_signal' with value in config file: False.
2019-06-14 04:49:18,478 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using minimal_roi: {'0': 0.4}
2019-06-14 04:49:18,478 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ticker_interval: 6h
2019-06-14 04:49:18,479 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stoploss: -0.1
2019-06-14 04:49:18,479 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop: True
2019-06-14 04:49:18,479 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive: 0.075
2019-06-14 04:49:18,479 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive_offset: 0.15
2019-06-14 04:49:18,479 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_only_offset_is_reached: True
2019-06-14 04:49:18,479 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using process_only_new_candles: False
2019-06-14 04:49:18,480 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_types: {'buy': 'market', 'sell': 'market', 'stoploss': 'market', 'stoploss_on_exchange': True}
2019-06-14 04:49:18,480 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_time_in_force: {'buy': 'gtc', 'sell': 'gtc'}
2019-06-14 04:49:18,480 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_currency: BTC
2019-06-14 04:49:18,480 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_amount: 0.01
2019-06-14 04:49:18,480 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_sell_signal: True
2019-06-14 04:49:18,480 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using sell_profit_only: False
2019-06-14 04:49:18,481 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_roi_if_buy_signal: False
2019-06-14 04:49:18,481 - freqtrade.rpc.rpc_manager - INFO - Enabling rpc.telegram ...
2019-06-14 04:49:18,517 - freqtrade.rpc.telegram - INFO - rpc.telegram is listening for following commands: [['status'], ['profit'], ['balance'], ['start'], ['stop'], ['forcesell'], ['forcebuy'], ['performance'], ['daily'], ['count'], ['reload_conf'], ['stopbuy'], ['whitelist'], ['blacklist'], ['edge'], ['help'], ['version']]
2019-06-14 04:49:18,609 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
2019-06-14 04:49:18,611 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True, 'rateLimit': 1000}
2019-06-14 04:49:18,619 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
2019-06-14 04:49:18,799 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange Binance
2019-06-14 04:49:19,137 - freqtrade.wallets - INFO - Wallets synced.
2019-06-14 04:49:19,138 - freqtrade.resolvers.pairlist_resolver - WARNING - Path "user_data/pairlist" does not exist
2019-06-14 04:49:19,141 - freqtrade.resolvers.pairlist_resolver - INFO - Using resolved pairlist StaticPairList from '/home/dante/freqtrade/freqtrade/pairlist'
2019-06-14 04:49:19,151 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': status, 'status': 'running'}
2019-06-14 04:49:20,166 - freqtrade.worker - INFO - Changing state to: RUNNING
2019-06-14 04:49:20,168 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': custom, 'status': "*Exchange:* `binance`\n*Stake per trade:* `0.01 BTC`\n*Minimum ROI:* `{'0': 0.4}`\n*Trailing Stoploss:* `-0.1`\n*Ticker Interval:* `6h`\n*Strategy:* `strategy`"}
2019-06-14 04:49:20,519 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': status, 'status': "Searching for BTC pairs to buy and sell based on StaticPairList: ['ADA/BTC', 'ADX/BTC', 'AE/BTC', 'AGI/BTC', 'AION/BTC', 'AMB/BTC', 'APPC/BTC', 'ARDR/BTC', 'ARK/BTC', 'ARN/BTC', 'AST/BTC', 'ATOM/BTC', 'BAT/BTC', 'BCD/BTC', 'BCPT/BTC', 'BLZ/BTC', 'BNT/BTC', 'BQX/BTC', 'BRD/BTC', 'BTG/BTC', 'BTS/BTC', 'CDT/BTC', 'CELR/BTC', 'CMT/BTC', 'CND/BTC', 'CVC/BTC', 'DASH/BTC', 'DATA/BTC', 'DCR/BTC', 'DGD/BTC', 'DLT/BTC', 'DNT/BTC', 'DOCK/BTC', 'EDO/BTC', 'ELF/BTC', 'ENG/BTC', 'ENJ/BTC', 'EOS/BTC', 'ETC/BTC', 'ETH/BTC', 'EVX/BTC', 'FET/BTC', 'GAS/BTC', 'GNT/BTC', 'GO/BTC', 'GRS/BTC', 'GTO/BTC', 'GVT/BTC', 'GXS/BTC', 'HC/BTC', 'ICX/BTC', 'INS/BTC', 'IOST/BTC', 'IOTA/BTC', 'IOTX/BTC', 'KMD/BTC', 'KNC/BTC', 'LINK/BTC', 'LOOM/BTC', 'LRC/BTC', 'LSK/BTC', 'LTC/BTC', 'LUN/BTC', 'MANA/BTC', 'MATIC/BTC', 'MCO/BTC', 'MDA/BTC', 'MITH/BTC', 'MTH/BTC', 'MTL/BTC', 'NANO/BTC', 'NAS/BTC', 'NAV/BTC', 'NEBL/BTC', 'NEO/BTC', 'NULS/BTC', 'NXS/BTC', 'OAX/BTC', 'OMG/BTC', 'ONT/BTC', 'OST/BTC', 'PHB/BTC', 'PIVX/BTC', 'POA/BTC', 'POLY/BTC', 'POWR/BTC', 'PPT/BTC', 'QKC/BTC', 'QLC/BTC', 'QSP/BTC', 'QTUM/BTC', 'RCN/BTC', 'RDN/BTC', 'REN/BTC', 'RLC/BTC', 'RVN/BTC', 'SKY/BTC', 'SNGLS/BTC', 'SNM/BTC', 'SNT/BTC', 'STEEM/BTC', 'STORJ/BTC', 'STRAT/BTC', 'SYS/BTC', 'TFUEL/BTC', 'THETA/BTC', 'TNT/BTC', 'TRX/BTC', 'VIA/BTC', 'VIB/BTC', 'VIBE/BTC', 'WABI/BTC', 'WAN/BTC', 'WAVES/BTC', 'WPR/BTC', 'WTC/BTC', 'XLM/BTC', 'XMR/BTC', 'XRP/BTC', 'XVG/BTC', 'XZC/BTC', 'ZEC/BTC', 'ZEN/BTC', 'ZIL/BTC', 'ZRX/BTC']"}
2019-06-14 04:51:29,434 - freqtrade.freqtradebot - WARNING - Stoploss order was cancelled, but unable to recreate one: Could not create stop_loss_limit sell order on market AST/BTC.Tried to sell amount 1636.0 at rate 6.79e-06 (total 0.01110844).Message: binance Order would trigger immediately.
2019-06-14 04:51:29,436 - freqtrade.freqtradebot - INFO - Trailing stoploss: cancelling current stoploss on exchange (id:{42518139})in order to add another one ...
2019-06-14 04:51:29,933 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 509, in fetch
response.raise_for_status()
File "/home/dante/.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?timestamp=1560487889911&amp;recvWindow=5000&amp;symbol=ASTBTC&amp;orderId=42518139&amp;signature=5a4cad630d7e165e3f519184127bcbc798562369ad31450d285fe066a7470684

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/dante/freqtrade/freqtrade/exchange/exchange.py", line 615, in cancel_order
return self._api.cancel_order(order_id, pair)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/binance.py", line 778, in cancel_order
}, params))
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 404, in inner
return entry(_self, **inner_kwargs)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/binance.py", line 1210, in request
response = self.fetch2(path, api, method, params, headers, body)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 429, in fetch2
return self.fetch(request['url'], request['method'], request['headers'], request['body'])
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 521, in fetch
self.handle_errors(response.status_code, response.reason, url, method, headers, http_response, json_response)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/binance.py", line 1203, in handle_errors
raise exceptions[error](self.id + ' ' + body)
ccxt.base.errors.OrderNotFound: binance {"code":-2011,"msg":"Unknown order sent."}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/dante/freqtrade/freqtrade/main.py", line 42, in main
worker.run()
File "/home/dante/freqtrade/freqtrade/worker.py", line 72, in run
state = self._worker(old_state=state)
File "/home/dante/freqtrade/freqtrade/worker.py", line 110, in _worker
self._throttle(func=self._process, min_secs=throttle_secs)
File "/home/dante/freqtrade/freqtrade/worker.py", line 123, in _throttle
result = func(*args, **kwargs)
File "/home/dante/freqtrade/freqtrade/worker.py", line 133, in _process
state_changed = self.freqtrade.process()
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 125, in process
state_changed |= self.process_maybe_execute_sell(trade)
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 441, in process_maybe_execute_sell
result = self.handle_stoploss_on_exchange(trade)
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 663, in handle_stoploss_on_exchange
self.handle_trailing_stoploss_on_exchange(trade, stoploss_order)
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 683, in handle_trailing_stoploss_on_exchange
if self.exchange.cancel_order(order['id'], trade.pair):
File "/home/dante/freqtrade/freqtrade/exchange/exchange.py", line 51, in wrapper
return f(*args, **kwargs)
File "/home/dante/freqtrade/freqtrade/exchange/exchange.py", line 618, in cancel_order
f'Could not cancel order. Message: {e}')
freqtrade.InvalidOrderException: Could not cancel order. Message: binance {"code":-2011,"msg":"Unknown order sent."}
2019-06-14 04:51:29,940 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': status, 'status': 'process died'}
2019-06-14 04:51:30,287 - freqtrade.freqtradebot - INFO - Cleaning up modules ...
2019-06-14 04:51:30,288 - freqtrade.rpc.rpc_manager - INFO - Cleaning up rpc modules ...
2019-06-14 04:51:32,520 - freqtrade.configuration - INFO - Verbosity set to 0
2019-06-14 04:51:32,521 - freqtrade.configuration - INFO - Dry run is disabled
2019-06-14 04:51:32,522 - freqtrade.configuration - WARNING - `forcebuy` RPC message enabled.
2019-06-14 04:51:32,522 - freqtrade.configuration - INFO - Using DB: "sqlite:///binancegobble.sqlite"
2019-06-14 04:51:32,522 - freqtrade.configuration - INFO - Using max_open_trades: 50 ...
2019-06-14 04:51:32,522 - freqtrade.configuration - INFO - Using data folder: user_data/data/binance ...
2019-06-14 04:51:32,523 - freqtrade.freqtradebot - INFO - Starting freqtrade 0.18.5-dev
2019-06-14 04:51:32,524 - freqtrade.resolvers.strategy_resolver - INFO - Using resolved strategy strategy from '/home/dante/freqtrade/user_data/strategies'
2019-06-14 04:51:32,524 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_currency' with value in config file: BTC.
2019-06-14 04:51:32,525 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_amount' with value in config file: 0.01.
2019-06-14 04:51:32,525 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'use_sell_signal' with value in config file: True.
2019-06-14 04:51:32,525 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'sell_profit_only' with value in config file: False.
2019-06-14 04:51:32,525 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'ignore_roi_if_buy_signal' with value in config file: False.
2019-06-14 04:51:32,525 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using minimal_roi: {'0': 0.4}
2019-06-14 04:51:32,526 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ticker_interval: 6h
2019-06-14 04:51:32,526 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stoploss: -0.1
2019-06-14 04:51:32,526 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop: True
2019-06-14 04:51:32,526 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive: 0.075
2019-06-14 04:51:32,527 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive_offset: 0.15
2019-06-14 04:51:32,527 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_only_offset_is_reached: True
2019-06-14 04:51:32,527 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using process_only_new_candles: False
2019-06-14 04:51:32,527 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_types: {'buy': 'market', 'sell': 'market', 'stoploss': 'market', 'stoploss_on_exchange': True}
2019-06-14 04:51:32,527 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_time_in_force: {'buy': 'gtc', 'sell': 'gtc'}
2019-06-14 04:51:32,527 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_currency: BTC
2019-06-14 04:51:32,528 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_amount: 0.01
2019-06-14 04:51:32,528 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_sell_signal: True
2019-06-14 04:51:32,528 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using sell_profit_only: False
2019-06-14 04:51:32,528 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_roi_if_buy_signal: False
2019-06-14 04:51:32,529 - freqtrade.rpc.rpc_manager - INFO - Enabling rpc.telegram ...
2019-06-14 04:51:32,569 - freqtrade.rpc.telegram - INFO - rpc.telegram is listening for following commands: [['status'], ['profit'], ['balance'], ['start'], ['stop'], ['forcesell'], ['forcebuy'], ['performance'], ['daily'], ['count'], ['reload_conf'], ['stopbuy'], ['whitelist'], ['blacklist'], ['edge'], ['help'], ['version']]
2019-06-14 04:51:32,654 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
2019-06-14 04:51:32,658 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True, 'rateLimit': 1000}
2019-06-14 04:51:32,666 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
2019-06-14 04:51:32,856 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange Binance
2019-06-14 04:51:33,189 - freqtrade.wallets - INFO - Wallets synced.
2019-06-14 04:51:33,190 - freqtrade.resolvers.pairlist_resolver - WARNING - Path "user_data/pairlist" does not exist
2019-06-14 04:51:33,194 - freqtrade.resolvers.pairlist_resolver - INFO - Using resolved pairlist StaticPairList from '/home/dante/freqtrade/freqtrade/pairlist'
2019-06-14 04:51:33,207 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': status, 'status': 'running'}
2019-06-14 04:51:34,235 - freqtrade.worker - INFO - Changing state to: RUNNING
2019-06-14 04:51:34,236 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': custom, 'status': "*Exchange:* `binance`\n*Stake per trade:* `0.01 BTC`\n*Minimum ROI:* `{'0': 0.4}`\n*Trailing Stoploss:* `-0.1`\n*Ticker Interval:* `6h`\n*Strategy:* `strategy`"}
2019-06-14 04:51:34,611 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': status, 'status': "Searching for BTC pairs to buy and sell based on StaticPairList: ['ADA/BTC', 'ADX/BTC', 'AE/BTC', 'AGI/BTC', 'AION/BTC', 'AMB/BTC', 'APPC/BTC', 'ARDR/BTC', 'ARK/BTC', 'ARN/BTC', 'AST/BTC', 'ATOM/BTC', 'BAT/BTC', 'BCD/BTC', 'BCPT/BTC', 'BLZ/BTC', 'BNT/BTC', 'BQX/BTC', 'BRD/BTC', 'BTG/BTC', 'BTS/BTC', 'CDT/BTC', 'CELR/BTC', 'CMT/BTC', 'CND/BTC', 'CVC/BTC', 'DASH/BTC', 'DATA/BTC', 'DCR/BTC', 'DGD/BTC', 'DLT/BTC', 'DNT/BTC', 'DOCK/BTC', 'EDO/BTC', 'ELF/BTC', 'ENG/BTC', 'ENJ/BTC', 'EOS/BTC', 'ETC/BTC', 'ETH/BTC', 'EVX/BTC', 'FET/BTC', 'GAS/BTC', 'GNT/BTC', 'GO/BTC', 'GRS/BTC', 'GTO/BTC', 'GVT/BTC', 'GXS/BTC', 'HC/BTC', 'ICX/BTC', 'INS/BTC', 'IOST/BTC', 'IOTA/BTC', 'IOTX/BTC', 'KMD/BTC', 'KNC/BTC', 'LINK/BTC', 'LOOM/BTC', 'LRC/BTC', 'LSK/BTC', 'LTC/BTC', 'LUN/BTC', 'MANA/BTC', 'MATIC/BTC', 'MCO/BTC', 'MDA/BTC', 'MITH/BTC', 'MTH/BTC', 'MTL/BTC', 'NANO/BTC', 'NAS/BTC', 'NAV/BTC', 'NEBL/BTC', 'NEO/BTC', 'NULS/BTC', 'NXS/BTC', 'OAX/BTC', 'OMG/BTC', 'ONT/BTC', 'OST/BTC', 'PHB/BTC', 'PIVX/BTC', 'POA/BTC', 'POLY/BTC', 'POWR/BTC', 'PPT/BTC', 'QKC/BTC', 'QLC/BTC', 'QSP/BTC', 'QTUM/BTC', 'RCN/BTC', 'RDN/BTC', 'REN/BTC', 'RLC/BTC', 'RVN/BTC', 'SKY/BTC', 'SNGLS/BTC', 'SNM/BTC', 'SNT/BTC', 'STEEM/BTC', 'STORJ/BTC', 'STRAT/BTC', 'SYS/BTC', 'TFUEL/BTC', 'THETA/BTC', 'TNT/BTC', 'TRX/BTC', 'VIA/BTC', 'VIB/BTC', 'VIBE/BTC', 'WABI/BTC', 'WAN/BTC', 'WAVES/BTC', 'WPR/BTC', 'WTC/BTC', 'XLM/BTC', 'XMR/BTC', 'XRP/BTC', 'XVG/BTC', 'XZC/BTC', 'ZEC/BTC', 'ZEN/BTC', 'ZIL/BTC', 'ZRX/BTC']"}
2019-06-14 04:53:43,687 - freqtrade.freqtradebot - WARNING - Stoploss order was cancelled, but unable to recreate one: Could not create stop_loss_limit sell order on market AST/BTC.Tried to sell amount 1636.0 at rate 6.79e-06 (total 0.01110844).Message: binance Order would trigger immediately.
2019-06-14 04:53:43,690 - freqtrade.freqtradebot - INFO - Trailing stoploss: cancelling current stoploss on exchange (id:{42518139})in order to add another one ...
2019-06-14 04:53:44,175 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 509, in fetch
response.raise_for_status()
File "/home/dante/.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?timestamp=1560488024160&amp;recvWindow=5000&amp;symbol=ASTBTC&amp;orderId=42518139&amp;signature=5cc13c45f058c425c01e99116d97745cda7a08152204be524f7107f923ff23f3

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/dante/freqtrade/freqtrade/exchange/exchange.py", line 615, in cancel_order
return self._api.cancel_order(order_id, pair)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/binance.py", line 778, in cancel_order
}, params))
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 404, in inner
return entry(_self, **inner_kwargs)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/binance.py", line 1210, in request
response = self.fetch2(path, api, method, params, headers, body)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 429, in fetch2
return self.fetch(request['url'], request['method'], request['headers'], request['body'])
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 521, in fetch
self.handle_errors(response.status_code, response.reason, url, method, headers, http_response, json_response)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/binance.py", line 1203, in handle_errors
raise exceptions[error](self.id + ' ' + body)
ccxt.base.errors.OrderNotFound: binance {"code":-2011,"msg":"Unknown order sent."}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/dante/freqtrade/freqtrade/main.py", line 42, in main
worker.run()
File "/home/dante/freqtrade/freqtrade/worker.py", line 72, in run
state = self._worker(old_state=state)
File "/home/dante/freqtrade/freqtrade/worker.py", line 110, in _worker
self._throttle(func=self._process, min_secs=throttle_secs)
File "/home/dante/freqtrade/freqtrade/worker.py", line 123, in _throttle
result = func(*args, **kwargs)
File "/home/dante/freqtrade/freqtrade/worker.py", line 133, in _process
state_changed = self.freqtrade.process()
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 125, in process
state_changed |= self.process_maybe_execute_sell(trade)
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 441, in process_maybe_execute_sell
result = self.handle_stoploss_on_exchange(trade)
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 663, in handle_stoploss_on_exchange
self.handle_trailing_stoploss_on_exchange(trade, stoploss_order)
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 683, in handle_trailing_stoploss_on_exchange
if self.exchange.cancel_order(order['id'], trade.pair):
File "/home/dante/freqtrade/freqtrade/exchange/exchange.py", line 51, in wrapper
return f(*args, **kwargs)
File "/home/dante/freqtrade/freqtrade/exchange/exchange.py", line 618, in cancel_order
f'Could not cancel order. Message: {e}')
freqtrade.InvalidOrderException: Could not cancel order. Message: binance {"code":-2011,"msg":"Unknown order sent."}
2019-06-14 04:53:44,181 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': status, 'status': 'process died'}
2019-06-14 04:53:44,527 - freqtrade.freqtradebot - INFO - Cleaning up modules ...
2019-06-14 04:53:44,528 - freqtrade.rpc.rpc_manager - INFO - Cleaning up rpc modules ...
2019-06-14 04:53:46,551 - freqtrade.configuration - INFO - Verbosity set to 0
2019-06-14 04:53:46,553 - freqtrade.configuration - INFO - Dry run is disabled
2019-06-14 04:53:46,553 - freqtrade.configuration - WARNING - `forcebuy` RPC message enabled.
2019-06-14 04:53:46,554 - freqtrade.configuration - INFO - Using DB: "sqlite:///binancegobble.sqlite"
2019-06-14 04:53:46,554 - freqtrade.configuration - INFO - Using max_open_trades: 50 ...
2019-06-14 04:53:46,554 - freqtrade.configuration - INFO - Using data folder: user_data/data/binance ...
2019-06-14 04:53:46,555 - freqtrade.freqtradebot - INFO - Starting freqtrade 0.18.5-dev
2019-06-14 04:53:46,556 - freqtrade.resolvers.strategy_resolver - INFO - Using resolved strategy strategy from '/home/dante/freqtrade/user_data/strategies'
2019-06-14 04:53:46,556 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_currency' with value in config file: BTC.
2019-06-14 04:53:46,557 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_amount' with value in config file: 0.01.
2019-06-14 04:53:46,557 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'use_sell_signal' with value in config file: True.
2019-06-14 04:53:46,557 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'sell_profit_only' with value in config file: False.
2019-06-14 04:53:46,558 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'ignore_roi_if_buy_signal' with value in config file: False.
2019-06-14 04:53:46,558 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using minimal_roi: {'0': 0.4}
2019-06-14 04:53:46,558 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ticker_interval: 6h
2019-06-14 04:53:46,558 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stoploss: -0.1
2019-06-14 04:53:46,559 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop: True
2019-06-14 04:53:46,559 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive: 0.075
2019-06-14 04:53:46,559 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive_offset: 0.15
2019-06-14 04:53:46,559 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_only_offset_is_reached: True
2019-06-14 04:53:46,560 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using process_only_new_candles: False
2019-06-14 04:53:46,560 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_types: {'buy': 'market', 'sell': 'market', 'stoploss': 'market', 'stoploss_on_exchange': True}
2019-06-14 04:53:46,560 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_time_in_force: {'buy': 'gtc', 'sell': 'gtc'}
2019-06-14 04:53:46,560 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_currency: BTC
2019-06-14 04:53:46,560 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_amount: 0.01
2019-06-14 04:53:46,561 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_sell_signal: True
2019-06-14 04:53:46,561 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using sell_profit_only: False
2019-06-14 04:53:46,561 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_roi_if_buy_signal: False
2019-06-14 04:53:46,561 - freqtrade.rpc.rpc_manager - INFO - Enabling rpc.telegram ...
2019-06-14 04:53:46,604 - freqtrade.rpc.telegram - INFO - rpc.telegram is listening for following commands: [['status'], ['profit'], ['balance'], ['start'], ['stop'], ['forcesell'], ['forcebuy'], ['performance'], ['daily'], ['count'], ['reload_conf'], ['stopbuy'], ['whitelist'], ['blacklist'], ['edge'], ['help'], ['version']]
2019-06-14 04:53:46,708 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
2019-06-14 04:53:46,712 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True, 'rateLimit': 1000}
2019-06-14 04:53:46,723 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
2019-06-14 04:53:46,923 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange Binance
2019-06-14 04:53:47,254 - freqtrade.wallets - INFO - Wallets synced.
2019-06-14 04:53:47,255 - freqtrade.resolvers.pairlist_resolver - WARNING - Path "user_data/pairlist" does not exist
2019-06-14 04:53:47,258 - freqtrade.resolvers.pairlist_resolver - INFO - Using resolved pairlist StaticPairList from '/home/dante/freqtrade/freqtrade/pairlist'
2019-06-14 04:53:47,271 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': status, 'status': 'running'}
2019-06-14 04:53:48,291 - freqtrade.worker - INFO - Changing state to: RUNNING
2019-06-14 04:53:48,292 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': custom, 'status': "*Exchange:* `binance`\n*Stake per trade:* `0.01 BTC`\n*Minimum ROI:* `{'0': 0.4}`\n*Trailing Stoploss:* `-0.1`\n*Ticker Interval:* `6h`\n*Strategy:* `strategy`"}
2019-06-14 04:53:48,639 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': status, 'status': "Searching for BTC pairs to buy and sell based on StaticPairList: ['ADA/BTC', 'ADX/BTC', 'AE/BTC', 'AGI/BTC', 'AION/BTC', 'AMB/BTC', 'APPC/BTC', 'ARDR/BTC', 'ARK/BTC', 'ARN/BTC', 'AST/BTC', 'ATOM/BTC', 'BAT/BTC', 'BCD/BTC', 'BCPT/BTC', 'BLZ/BTC', 'BNT/BTC', 'BQX/BTC', 'BRD/BTC', 'BTG/BTC', 'BTS/BTC', 'CDT/BTC', 'CELR/BTC', 'CMT/BTC', 'CND/BTC', 'CVC/BTC', 'DASH/BTC', 'DATA/BTC', 'DCR/BTC', 'DGD/BTC', 'DLT/BTC', 'DNT/BTC', 'DOCK/BTC', 'EDO/BTC', 'ELF/BTC', 'ENG/BTC', 'ENJ/BTC', 'EOS/BTC', 'ETC/BTC', 'ETH/BTC', 'EVX/BTC', 'FET/BTC', 'GAS/BTC', 'GNT/BTC', 'GO/BTC', 'GRS/BTC', 'GTO/BTC', 'GVT/BTC', 'GXS/BTC', 'HC/BTC', 'ICX/BTC', 'INS/BTC', 'IOST/BTC', 'IOTA/BTC', 'IOTX/BTC', 'KMD/BTC', 'KNC/BTC', 'LINK/BTC', 'LOOM/BTC', 'LRC/BTC', 'LSK/BTC', 'LTC/BTC', 'LUN/BTC', 'MANA/BTC', 'MATIC/BTC', 'MCO/BTC', 'MDA/BTC', 'MITH/BTC', 'MTH/BTC', 'MTL/BTC', 'NANO/BTC', 'NAS/BTC', 'NAV/BTC', 'NEBL/BTC', 'NEO/BTC', 'NULS/BTC', 'NXS/BTC', 'OAX/BTC', 'OMG/BTC', 'ONT/BTC', 'OST/BTC', 'PHB/BTC', 'PIVX/BTC', 'POA/BTC', 'POLY/BTC', 'POWR/BTC', 'PPT/BTC', 'QKC/BTC', 'QLC/BTC', 'QSP/BTC', 'QTUM/BTC', 'RCN/BTC', 'RDN/BTC', 'REN/BTC', 'RLC/BTC', 'RVN/BTC', 'SKY/BTC', 'SNGLS/BTC', 'SNM/BTC', 'SNT/BTC', 'STEEM/BTC', 'STORJ/BTC', 'STRAT/BTC', 'SYS/BTC', 'TFUEL/BTC', 'THETA/BTC', 'TNT/BTC', 'TRX/BTC', 'VIA/BTC', 'VIB/BTC', 'VIBE/BTC', 'WABI/BTC', 'WAN/BTC', 'WAVES/BTC', 'WPR/BTC', 'WTC/BTC', 'XLM/BTC', 'XMR/BTC', 'XRP/BTC', 'XVG/BTC', 'XZC/BTC', 'ZEC/BTC', 'ZEN/BTC', 'ZIL/BTC', 'ZRX/BTC']"}
2019-06-14 04:54:21,761 - freqtrade.rpc.telegram - INFO - Executing handler: _balance for chat_id: 146554112
2019-06-14 04:55:57,629 - freqtrade.freqtradebot - WARNING - Stoploss order was cancelled, but unable to recreate one: Could not create stop_loss_limit sell order on market AST/BTC.Tried to sell amount 1636.0 at rate 6.79e-06 (total 0.01110844).Message: binance Order would trigger immediately.
2019-06-14 04:55:57,634 - freqtrade.freqtradebot - INFO - Trailing stoploss: cancelling current stoploss on exchange (id:{42518139})in order to add another one ...
2019-06-14 04:55:58,131 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 509, in fetch
response.raise_for_status()
File "/home/dante/.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?timestamp=1560488158109&amp;recvWindow=5000&amp;symbol=ASTBTC&amp;orderId=42518139&amp;signature=16ad2a9c3f3f8c9253ed978245ebaaa3f99239f915c9d6f51b292166b0f7cf07

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/dante/freqtrade/freqtrade/exchange/exchange.py", line 615, in cancel_order
return self._api.cancel_order(order_id, pair)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/binance.py", line 778, in cancel_order
}, params))
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 404, in inner
return entry(_self, **inner_kwargs)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/binance.py", line 1210, in request
response = self.fetch2(path, api, method, params, headers, body)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 429, in fetch2
return self.fetch(request['url'], request['method'], request['headers'], request['body'])
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/base/exchange.py", line 521, in fetch
self.handle_errors(response.status_code, response.reason, url, method, headers, http_response, json_response)
File "/home/dante/.local/lib/python3.7/site-packages/ccxt/binance.py", line 1203, in handle_errors
raise exceptions[error](self.id + ' ' + body)
ccxt.base.errors.OrderNotFound: binance {"code":-2011,"msg":"Unknown order sent."}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/dante/freqtrade/freqtrade/main.py", line 42, in main
worker.run()
File "/home/dante/freqtrade/freqtrade/worker.py", line 72, in run
state = self._worker(old_state=state)
File "/home/dante/freqtrade/freqtrade/worker.py", line 110, in _worker
self._throttle(func=self._process, min_secs=throttle_secs)
File "/home/dante/freqtrade/freqtrade/worker.py", line 123, in _throttle
result = func(*args, **kwargs)
File "/home/dante/freqtrade/freqtrade/worker.py", line 133, in _process
state_changed = self.freqtrade.process()
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 125, in process
state_changed |= self.process_maybe_execute_sell(trade)
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 441, in process_maybe_execute_sell
result = self.handle_stoploss_on_exchange(trade)
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 663, in handle_stoploss_on_exchange
self.handle_trailing_stoploss_on_exchange(trade, stoploss_order)
File "/home/dante/freqtrade/freqtrade/freqtradebot.py", line 683, in handle_trailing_stoploss_on_exchange
if self.exchange.cancel_order(order['id'], trade.pair):
File "/home/dante/freqtrade/freqtrade/exchange/exchange.py", line 51, in wrapper
return f(*args, **kwargs)
File "/home/dante/freqtrade/freqtrade/exchange/exchange.py", line 618, in cancel_order
f'Could not cancel order. Message: {e}')
freqtrade.InvalidOrderException: Could not cancel order. Message: binance {"code":-2011,"msg":"Unknown order sent."}
2019-06-14 04:55:58,137 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': status, 'status': 'process died'}
2019-06-14 04:55:58,493 - freqtrade.freqtradebot - INFO - Cleaning up modules ...
2019-06-14 04:55:58,493 - freqtrade.rpc.rpc_manager - INFO - Cleaning up rpc modules ...

# Fixed code
def handle_trailing_stoploss_on_exchange(self, trade: Trade, order):
    """
    Check to see if stoploss on exchange should be updated
    in case of trailing stoploss on exchange
    :param Trade: Corresponding Trade
    :param order: Current on exchange stoploss order
    :return: None
    """

    if trade.stop_loss > float(order["info"]["stopPrice"]):
        # we check if the update is neccesary
        update_beat = self.strategy.order_types.get("stoploss_on_exchange_interval", 60)
        if (
            datetime.utcnow() - trade.stoploss_last_update
        ).total_seconds() > update_beat:
            # cancelling the current stoploss on exchange first
            logger.info(
                "Trailing stoploss: cancelling current stoploss on exchange (id:{%s})"
                "in order to add another one ...",
                order["id"],
            )
            try:
                self.exchange.cancel_order(order["id"], trade.pair)
            except InvalidOrderException:
                logger.exception(
                    f"Could not cancel stoploss order {order['id']} "
                    f"for pair {trade.pair}"
                )

            try:
                # creating the new one
                stoploss_order_id = self.exchange.stoploss_limit(
                    pair=trade.pair,
                    amount=trade.amount,
                    stop_price=trade.stop_loss,
                    rate=trade.stop_loss * 0.99,
                )["id"]
                trade.stoploss_order_id = str(stoploss_order_id)
            except DependencyException:
                logger.exception(
                    f"Could create trailing stoploss order for pair {trade.pair}."
                )