Repository: freqtrade/freqtrade

Issue:
Unable to Perform Sell in dry mode, broken persistance.py
Hi,
Since two days I'm trying to figure out why my fresh installed bot can't perform sell operations on Dry run mode. Even If I perform a force sell all trades stay open.
I suspected a breaking change in SQLAlchemy, so I rollbacked to a previous version, unsucessfully.
So I checked the persistance.py file and tried previous version. And surprisingly the bot is performing normaly if I go back to this commit "cfe00c2f0c118c93e1870567eb75c195bfa91ddd"
I'm investigating to figure out what is hapenning excactly.



Discussion:
that's a tough one, that commit is from 2 months ago ... TONS of things will have changed.

what are your configurations?
stoploss / stoploss on exchange, 

There must be anything in the logs when you run /forcesell ... ?

Yes it is, I Had some suspicion on that commit (0c53bd6dd48c71837bc4ffec6cfe468f788e7b13) "Complete refactor, moving query_trades to persistance as get_open_trades" but I didn't saw anything suspicious.
My stop loss is as -2%, and I confirm that I have nothing abnormal in the log when I perform a force sell, even in verbose mode. I will continue to check tomorrow
You Managed to reproduce the issue?
If it where related to this commit, the bot should not see / try to sell the trades...

yes(ish) ... my bot is up with the official docker image (freqtradeorg/freqtrade:develop) updated 3 weeks ago in dry-run mode (stability test) - and I didn't see any issue there, it's been buying and selling happliy - but i've never force-sold. 

I've now updated to "today's" image and trying to forcesell.

I have the database file mounted ... 
after a restart - /forcesell 178:

```
2019-03-08 06:51:49,738 - freqtrade.rpc.telegram - INFO - Executing handler: _status_table for chat_id: 462034882
2019-03-08 06:51:49,747 - freqtrade.exchange.exchange - INFO - returning cached ticker-data for BTG/ETH
2019-03-08 06:51:49,750 - freqtrade.exchange.exchange - INFO - returning cached ticker-data for XMR/ETH
2019-03-08 06:51:49,750 - freqtrade.exchange.exchange - INFO - returning cached ticker-data for XVG/ETH
2019-03-08 06:51:57,639 - freqtrade.rpc.telegram - INFO - Executing handler: _forcesell for chat_id: 462034882
2019-03-08 06:51:57,673 - freqtrade.exchange.exchange - INFO - returning cached ticker-data for XVG/ETH
2019-03-08 06:51:57,867 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'XVG/ETH', 'gain': 'loss', 'limit': 4.511e-05, 'amount': 2188.183807439825, 'open_rate': 4.57e-05, 'current_rate': 4.511e-05, 'profit_amount': -0.00148974, 'profit_percent': -0.01488249, 'sell_reason': 'force_sell', 'stake_currency': 'ETH', 'fiat_currency': 'USD'}

2019-03-08 06:59:04,485 - freqtrade.rpc.telegram - INFO - Executing handler: _status for chat_id: 462034882
2019-03-08 06:59:04,485 - freqtrade.rpc.telegram - INFO - Executing handler: _status_table for chat_id: 462034882
2019-03-08 06:59:04,533 - freqtrade.exchange.exchange - INFO - returning cached ticker-data for BTG/ETH
2019-03-08 06:59:04,534 - freqtrade.exchange.exchange - INFO - returning cached ticker-data for XMR/ETH
2019-03-08 06:59:04,535 - freqtrade.exchange.exchange - INFO - returning cached ticker-data for XVG/ETH
2019-03-08 06:59:05,826 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=178, pair=XVG/ETH, amount=2188.18380744, open_rate=0.00004499, open_since=2 hours ago)
2019-03-08 06:59:05,827 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=178, pair=XVG/ETH, amount=2188.18380744, open_rate=0.00004499, open_since=2 hours ago) failed: myTrade-Dict empty found
2019-03-08 06:59:05,827 - freqtrade.persistence - INFO - Updating trade (id=178) ...
2019-03-08 06:59:05,827 - freqtrade.persistence - INFO - LIMIT_BUY has been fulfilled for Trade(id=178, pair=XVG/ETH, amount=2188.18380744, open_rate=0.00004500, open_since=2 hours ago).

```

It appears as if the bot would still have the open_order_id - so thinks the trade is still open and does an immediate buy again.

i THINK It's related to forcesell in dry-mode only ... did you see it in regular trading-mode as well?

will need to monitor my 2(just updated) bots after they do some regular trades ... 
You are right my bot just managed to perform a sell with a sell_signal reason on dry mode. 
if you run `/status table` ... is it "really" sold or still there?
It's showing "no open order" . And /performance show performance or executed trades as expected
Recently I have the same problem. I am on the last develop commit and the bot can't perform a sell.

An extract from the log that can be useful:

```
2019-03-06 20:16:10,804 - freqtrade.freqtradebot - INFO - Buy signal found: about create a new trade with stake_amount: 0.3 ...
2019-03-06 20:16:10,805 - freqtrade.freqtradebot - INFO - Using Last Ask / Last Price
2019-03-06 20:16:11,615 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': buy, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'limit': 7.668e-05, 'stake_amount': 0.3, 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:16:11,681 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:16:11,692 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:16:12,121 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007668, open_since=just now)
2019-03-06 20:16:12,123 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007668, open_since=just now) failed: myTrade-Dict empty found
2019-03-06 20:16:12,123 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:16:12,123 - freqtrade.persistence - INFO - LIMIT_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007668, open_since=just now).
2019-03-06 20:46:29,247 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.491e-05, 'amount': 3912.3630672926442, 'open_rate': 7.668e-05, 'current_rate': 7.496e-05, 'profit_amount': -0.00751796, 'profit_percent': -0.02503482, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:46:29,290 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:46:29,292 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:29,296 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:33,280 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007668, open_since=30 minutes ago)
2019-03-06 20:46:33,281 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007668, open_since=30 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:46:33,281 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:46:33,281 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007491, open_since=30 minutes ago).
2019-03-06 20:46:34,250 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.49e-05, 'amount': 3912.3630672926442, 'open_rate': 7.491e-05, 'current_rate': 7.49e-05, 'profit_amount': -0.00062523, 'profit_percent': -0.00213123, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:46:34,363 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:46:34,363 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:34,367 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:38,289 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007491, open_since=30 minutes ago)
2019-03-06 20:46:38,290 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007491, open_since=30 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:46:38,290 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:46:38,291 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007490, open_since=30 minutes ago).
2019-03-06 20:46:39,255 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.49e-05, 'amount': 3912.3630672926442, 'open_rate': 7.49e-05, 'current_rate': 7.49e-05, 'profit_amount': -0.00058607, 'profit_percent': -0.001998, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:46:39,295 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:46:39,296 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:39,300 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:43,284 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007490, open_since=30 minutes ago)
2019-03-06 20:46:43,284 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007490, open_since=30 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:46:43,284 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:46:43,285 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007490, open_since=30 minutes ago).
2019-03-06 20:46:44,256 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.49e-05, 'amount': 3912.3630672926442, 'open_rate': 7.49e-05, 'current_rate': 7.496e-05, 'profit_amount': -0.00058607, 'profit_percent': -0.001998, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:46:44,299 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:46:44,299 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:44,303 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:48,285 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007490, open_since=30 minutes ago)
2019-03-06 20:46:48,286 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007490, open_since=30 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:46:48,286 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:46:48,287 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007490, open_since=30 minutes ago).
2019-03-06 20:46:49,257 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.496e-05, 'amount': 3912.3630672926442, 'open_rate': 7.49e-05, 'current_rate': 7.496e-05, 'profit_amount': -0.00035156, 'profit_percent': -0.00119853, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:46:49,298 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:46:49,299 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:49,303 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:53,292 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007490, open_since=30 minutes ago)
2019-03-06 20:46:53,292 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007490, open_since=30 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:46:53,292 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:46:53,293 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007496, open_since=30 minutes ago).
2019-03-06 20:46:54,266 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.496e-05, 'amount': 3912.3630672926442, 'open_rate': 7.496e-05, 'current_rate': 7.496e-05, 'profit_amount': -0.00058654, 'profit_percent': -0.001998, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:46:54,314 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:46:54,315 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:54,318 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:58,304 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007496, open_since=30 minutes ago)
2019-03-06 20:46:58,304 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007496, open_since=30 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:46:58,305 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:46:58,305 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007496, open_since=30 minutes ago).
2019-03-06 20:46:59,270 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.496e-05, 'amount': 3912.3630672926442, 'open_rate': 7.496e-05, 'current_rate': 7.496e-05, 'profit_amount': -0.00058654, 'profit_percent': -0.001998, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:46:59,311 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:46:59,311 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:46:59,315 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:03,310 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007496, open_since=30 minutes ago)
2019-03-06 20:47:03,311 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007496, open_since=30 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:47:03,311 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:47:03,311 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007496, open_since=30 minutes ago).
2019-03-06 20:47:04,275 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.497e-05, 'amount': 3912.3630672926442, 'open_rate': 7.496e-05, 'current_rate': 7.497e-05, 'profit_amount': -0.00054746, 'profit_percent': -0.00186486, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:47:04,315 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:47:04,315 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:04,319 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:08,304 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007496, open_since=30 minutes ago)
2019-03-06 20:47:08,304 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007496, open_since=30 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:47:08,304 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:47:08,305 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007497, open_since=30 minutes ago).
2019-03-06 20:47:09,271 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.497e-05, 'amount': 3912.3630672926442, 'open_rate': 7.497e-05, 'current_rate': 7.497e-05, 'profit_amount': -0.00058662, 'profit_percent': -0.001998, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:47:09,329 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:47:09,329 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:09,334 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:13,302 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007497, open_since=31 minutes ago)
2019-03-06 20:47:13,302 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007497, open_since=31 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:47:13,302 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:47:13,303 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007497, open_since=31 minutes ago).
2019-03-06 20:47:14,275 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.498e-05, 'amount': 3912.3630672926442, 'open_rate': 7.497e-05, 'current_rate': 7.498e-05, 'profit_amount': -0.00054754, 'profit_percent': -0.00186488, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:47:14,313 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:47:14,314 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:14,316 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:18,308 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007497, open_since=31 minutes ago)
2019-03-06 20:47:18,309 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007497, open_since=31 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:47:18,309 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:47:18,309 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007498, open_since=31 minutes ago).
2019-03-06 20:47:19,282 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.498e-05, 'amount': 3912.3630672926442, 'open_rate': 7.498e-05, 'current_rate': 7.498e-05, 'profit_amount': -0.0005867, 'profit_percent': -0.001998, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:47:19,344 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:47:19,345 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:19,348 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:23,322 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007498, open_since=31 minutes ago)
2019-03-06 20:47:23,322 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007498, open_since=31 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:47:23,323 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:47:23,323 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007498, open_since=31 minutes ago).
2019-03-06 20:47:24,282 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.502e-05, 'amount': 3912.3630672926442, 'open_rate': 7.498e-05, 'current_rate': 7.502e-05, 'profit_amount': -0.00043036, 'profit_percent': -0.00146559, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:47:24,328 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:47:24,329 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:24,333 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:28,333 - freqtrade.freqtradebot - INFO - Found open order for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007498, open_since=31 minutes ago)
2019-03-06 20:47:28,333 - freqtrade.freqtradebot - INFO - Applying fee on amount for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007498, open_since=31 minutes ago) failed: myTrade-Dict empty found
2019-03-06 20:47:28,334 - freqtrade.persistence - INFO - Updating trade (id=1) ...
2019-03-06 20:47:28,334 - freqtrade.persistence - INFO - MARKET_BUY has been fulfilled for Trade(id=1, pair=EVX/BTC, amount=3912.36306729, open_rate=0.00007502, open_since=31 minutes ago).
2019-03-06 20:47:29,289 - freqtrade.rpc.rpc_manager - INFO - Sending rpc message: {'type': sell, 'exchange': 'Binance', 'pair': 'EVX/BTC', 'gain': 'loss', 'limit': 7.502e-05, 'amount': 3912.3630672926442, 'open_rate': 7.502e-05, 'current_rate': 7.502e-05, 'profit_amount': -0.00058701, 'profit_percent': -0.001998, 'sell_reason': 'trailing_stop_loss', 'stake_currency': 'BTC', 'fiat_currency': 'EUR'}
2019-03-06 20:47:29,333 - freqtrade.freqtradebot - INFO - executed sell, reason: SellType.TRAILING_STOP_LOSS
2019-03-06 20:47:29,334 - freqtrade.wallets - INFO - Wallets synced ...
2019-03-06 20:47:29,337 - freqtrade.wallets - INFO - Wallets synced ...
```
@gianlup did you use /forcesell on that trade ... ? 
No, the first sell was attempted at `2019-03-06 20:46:29,290` 30 min after the initial LIMIT_BUY.
would you happen to have the entry for `select * from trades where id = 1;` ... i hope that would help - but i won't have time to look at it until the evening.
```
id          exchange    pair        is_open     fee_open    fee_close   open_rate   open_rate_requested  close_rate  close_rate_requested  close_profit  stake_amount  amount            open_date                   close_date  open_order_id        stop_loss   initial_stop_loss  stoploss_order_id  stoploss_last_update        max_rate    sell_reason         strategy    ticker_interval
----------  ----------  ----------  ----------  ----------  ----------  ----------  -------------------  ----------  --------------------  ------------  ------------  ----------------  --------------------------  ----------  -------------------  ----------  -----------------  -----------------  --------------------------  ----------  ------------------  ----------  ---------------
1           binance     EVX/BTC     1           0.001       0.001       7.501e-05   7.668e-05                        7.501e-05                           0.3           3912.36306729264  2019-03-06 20:16:11.674854              dry_run_sell_263441  7.5166e-05  7.51464e-05                           2019-03-06 20:17:52.556022  7.67e-05    trailing_stop_loss  Turtle      120
```
Maybe related to #1639 (first test, comparing if the order is filled)...

I think the problem is not related to #1639 - but has to do with how dry-run orders are created:

![2019-03-08-210847_705x191_scrot](https://user-images.githubusercontent.com/5024695/54053062-6ab45f00-41e6-11e9-82e5-845f0540bbf1.png)

a sell-order with side "buy" should not be correct.
I'll investigate further, but the fix should be quick(ish)

Edit: 
culprit is here:
https://github.com/freqtrade/freqtrade/blob/d213764d193f3d2d6d54a7c97837fd1dac80247e/freqtrade/exchange/exchange.py#L301

makes dry-run sell-orders impossible since all are "buy" ...

Resolving patch:
diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py
--- a/freqtrade/exchange/exchange.py
+++ b/freqtrade/exchange/exchange.py
@@ -298,7 +298,7 @@ def dry_run_order(self, pair: str, ordertype: str, side: str, amount: float,
             'amount': amount,
             "cost": amount * rate,
             'type': ordertype,
-            'side': 'buy',
+            'side': side,
             'remaining': amount,
             'datetime': arrow.utcnow().isoformat(),
             'status': "open",


Test patch:
diff --git a/freqtrade/tests/exchange/test_exchange.py b/freqtrade/tests/exchange/test_exchange.py
--- a/freqtrade/tests/exchange/test_exchange.py
+++ b/freqtrade/tests/exchange/test_exchange.py
@@ -470,6 +470,9 @@ def test_dry_run_order(default_conf, mocker, side, exchange_name):
         pair='ETH/BTC', ordertype='limit', side=side, amount=1, rate=200)
     assert 'id' in order
     assert f'dry_run_{side}_' in order["id"]
+    assert order["side"] == side
+    assert order["type"] == "limit"
+    assert order["pair"] == "ETH/BTC"
 
 
 @pytest.mark.parametrize("side", [