From 6b7afb80b283dfad1f5db25c00bfffab47b74d01 Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Wed, 15 Nov 2017 07:05:17 +0200 Subject: [PATCH] fix failing test --- freqtrade/main.py | 2 +- freqtrade/tests/test_main.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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,