From 685820cc12368bef41244900cc8e1af94e59bd55 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 4 Mar 2022 19:48:34 +0100 Subject: [PATCH] Fix failures due to non-happening rounding --- tests/test_freqtradebot.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index ca0956861..eb6eacb62 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -3015,7 +3015,7 @@ def test_execute_trade_exit_up(default_conf_usdt, ticker_usdt, fee, ticker_usdt_ 'pair': 'ETH/USDT', 'gain': 'profit', 'limit': 2.0 if is_short else 2.2, - 'amount': amt, + 'amount': pytest.approx(amt), 'order_type': 'limit', 'buy_tag': None, 'direction': 'Short' if trade.is_short else 'Long', @@ -3076,7 +3076,7 @@ def test_execute_trade_exit_down(default_conf_usdt, ticker_usdt, fee, ticker_usd 'leverage': 1.0, 'gain': 'loss', 'limit': 2.2 if is_short else 2.01, - 'amount': 29.70297029 if is_short else 30.0, + 'amount': pytest.approx(29.70297029) if is_short else 30.0, 'order_type': 'limit', 'buy_tag': None, 'enter_tag': None, @@ -3156,13 +3156,13 @@ def test_execute_trade_exit_custom_exit_price( 'leverage': 1.0, 'gain': profit_or_loss, 'limit': limit, - 'amount': amount, + 'amount': pytest.approx(amount), 'order_type': 'limit', 'buy_tag': None, 'enter_tag': None, 'open_rate': open_rate, 'current_rate': current_rate, - 'profit_amount': profit_amount, + 'profit_amount': pytest.approx(profit_amount), 'profit_ratio': profit_ratio, 'stake_currency': 'USDT', 'fiat_currency': 'USD', @@ -3223,7 +3223,7 @@ def test_execute_trade_exit_down_stoploss_on_exchange_dry_run( 'leverage': 1.0, 'gain': 'loss', 'limit': 2.02 if is_short else 1.98, - 'amount': 29.70297029 if is_short else 30.0, + 'amount': pytest.approx(29.70297029 if is_short else 30.0), 'order_type': 'limit', 'buy_tag': None, 'enter_tag': None, @@ -3486,13 +3486,13 @@ def test_execute_trade_exit_market_order( 'leverage': 1.0, 'gain': profit_or_loss, 'limit': limit, - 'amount': round(amount, 9), + 'amount': pytest.approx(amount), 'order_type': 'market', 'buy_tag': None, 'enter_tag': None, 'open_rate': open_rate, 'current_rate': current_rate, - 'profit_amount': profit_amount, + 'profit_amount': pytest.approx(profit_amount), 'profit_ratio': profit_ratio, 'stake_currency': 'USDT', 'fiat_currency': 'USD',