diff --git a/freqtrade/main.py b/freqtrade/main.py index b2789ca9f..fe25dd204 100755 --- a/freqtrade/main.py +++ b/freqtrade/main.py @@ -183,7 +183,7 @@ def handle_trade(trade: Trade) -> bool: logger.debug('Handling %s ...', trade) current_rate = exchange.get_ticker(trade.pair)['bid'] - if should_sell(trade, current_rate, datetime.utcnow()) or get_signal(trade.pair, SignalType.SELL): + if should_sell(trade, current_rate, datetime.utcnow()) or get_signal(trade.pair, SignalType.SELL) == 1: execute_sell(trade, current_rate) return True return False diff --git a/freqtrade/tests/test_main.py b/freqtrade/tests/test_main.py index 5be1dce3e..ae7402945 100644 --- a/freqtrade/tests/test_main.py +++ b/freqtrade/tests/test_main.py @@ -7,6 +7,7 @@ import requests from sqlalchemy import create_engine from freqtrade.exchange import Exchanges +from freqtrade.analyze import SignalType from freqtrade.main import create_trade, handle_trade, close_trade_if_fulfilled, init, \ get_target_bid, _process from freqtrade.misc import get_state, State, FreqtradeException @@ -80,7 +81,7 @@ def test_process_runtime_error(default_conf, ticker, health, mocker): def test_process_trade_handling(default_conf, ticker, limit_buy_order, health, mocker): mocker.patch.dict('freqtrade.main._CONF', default_conf) mocker.patch.multiple('freqtrade.main.telegram', init=MagicMock(), send_msg=MagicMock()) - mocker.patch('freqtrade.main.get_signal', side_effect=lambda s, t: True) + signal = mocker.patch('freqtrade.main.get_signal', side_effect=lambda *args: False if args[1] == SignalType.SELL else True) mocker.patch.multiple('freqtrade.main.exchange', validate_pairs=MagicMock(), get_ticker=ticker,