From 1a5465fb508ca20318e36913cfb0cd2f12a995b1 Mon Sep 17 00:00:00 2001 From: misagh Date: Wed, 28 Nov 2018 19:35:10 +0100 Subject: [PATCH] logs enriched in case of stop loss on exchange, test fixed --- freqtrade/exchange/__init__.py | 8 +++++--- freqtrade/tests/test_freqtradebot.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/freqtrade/exchange/__init__.py b/freqtrade/exchange/__init__.py index 2480dbe32..baa9d573d 100644 --- a/freqtrade/exchange/__init__.py +++ b/freqtrade/exchange/__init__.py @@ -378,13 +378,15 @@ class Exchange(object): except ccxt.InsufficientFunds as e: raise DependencyException( - f'Insufficient funds to place stoploss limit order on market {pair}.' - f'Tried to put a stoploss amount {amount} at rate {rate} (total {rate*amount}).' + f'Insufficient funds to place stoploss limit order on market {pair}. ' + f'Tried to put a stoploss amount {amount} with ' + f'stop {stop_price} and limit {rate} (total {rate*amount}).' f'Message: {e}') except ccxt.InvalidOrder as e: raise DependencyException( f'Could not place stoploss limit order on market {pair}.' - f'Tried to place stoploss amount {amount} at rate {rate} (total {rate*amount}).' + f'Tried to place stoploss amount {amount} with ' + f'stop {stop_price} and limit {rate} (total {rate*amount}).' f'Message: {e}') except (ccxt.NetworkError, ccxt.ExchangeError) as e: raise TemporaryError( diff --git a/freqtrade/tests/test_freqtradebot.py b/freqtrade/tests/test_freqtradebot.py index 81ade608a..147d47b72 100644 --- a/freqtrade/tests/test_freqtradebot.py +++ b/freqtrade/tests/test_freqtradebot.py @@ -957,7 +957,8 @@ def test_handle_stoploss_on_exchange(mocker, default_conf, fee, caplog, stoploss_order_hit = MagicMock(return_value={ 'status': 'closed', 'type': 'stop_loss_limit', - 'price': 2 + 'price': 3, + 'average': 2 }) mocker.patch('freqtrade.exchange.Exchange.get_order', stoploss_order_hit) assert freqtrade.handle_stoploss_on_exchange(trade) is True