diff --git a/tests/persistence/test_persistence.py b/tests/persistence/test_persistence.py index b9606ee47..c30c27244 100644 --- a/tests/persistence/test_persistence.py +++ b/tests/persistence/test_persistence.py @@ -1931,9 +1931,9 @@ def test_get_overall_performance(fee): @pytest.mark.parametrize( "is_short,pair,profit", [ - (True, "ETC/BTC", -0.005), - (False, "XRP/BTC", 0.01), - (None, "XRP/BTC", 0.01), + (True, "XRP/BTC", -0.00018780487), + (False, "ETC/BTC", 0.00003860975), + (None, "XRP/BTC", 0.000025203252), ], ) def test_get_best_pair(fee, is_short, pair, profit): @@ -1942,9 +1942,9 @@ def test_get_best_pair(fee, is_short, pair, profit): create_mock_trades(fee, is_short) res = Trade.get_best_pair() - assert len(res) == 2 + assert len(res) == 4 assert res[0] == pair - assert res[1] == profit + assert pytest.approx(res[1]) == profit @pytest.mark.usefixtures("init_persistence") @@ -1954,9 +1954,9 @@ def test_get_best_pair_lev(fee): create_mock_trades_with_leverage(fee) res = Trade.get_best_pair() - assert len(res) == 2 - assert res[0] == "DOGE/BTC" - assert res[1] == 0.1713156134055116 + assert len(res) == 4 + assert res[0] == "ETC/BTC" + assert pytest.approx(res[1]) == 0.00003860975 @pytest.mark.usefixtures("init_persistence") diff --git a/tests/rpc/test_rpc.py b/tests/rpc/test_rpc.py index 909e9d911..71eaa3bfd 100644 --- a/tests/rpc/test_rpc.py +++ b/tests/rpc/test_rpc.py @@ -480,8 +480,8 @@ def test_rpc_trade_statistics(default_conf_usdt, ticker, fee, mocker) -> None: assert stats["first_trade_humanized"] == "2 days ago" assert stats["latest_trade_humanized"] == "17 minutes ago" assert stats["avg_duration"] in ("0:17:40") - assert stats["best_pair"] == "XRP/USDT" - assert stats["best_rate"] == 10.0 + assert stats["best_pair"] == "NEO/USDT" + assert stats["best_rate"] == 1.99 # Test non-available pair mocker.patch( @@ -492,8 +492,8 @@ def test_rpc_trade_statistics(default_conf_usdt, ticker, fee, mocker) -> None: assert stats["first_trade_humanized"] == "2 days ago" assert stats["latest_trade_humanized"] == "17 minutes ago" assert stats["avg_duration"] in ("0:17:40") - assert stats["best_pair"] == "XRP/USDT" - assert stats["best_rate"] == 10.0 + assert stats["best_pair"] == "NEO/USDT" + assert stats["best_rate"] == 1.99 assert isnan(stats["profit_all_coin"]) diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index bababed2c..2c895c963 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -963,9 +963,10 @@ def test_api_edge_disabled(botclient, mocker, ticker, fee, markets): ( True, { - "best_pair": "ETC/BTC", - "best_rate": -0.5, - "best_pair_profit_ratio": -0.005, + "best_pair": "XRP/BTC", + "best_rate": -0.02, + "best_pair_profit_ratio": -0.00018780487, + "best_pair_profit_abs": -0.001155, "profit_all_coin": 15.382312, "profit_all_fiat": 189894.6470718, "profit_all_percent_mean": 49.62, @@ -994,9 +995,10 @@ def test_api_edge_disabled(botclient, mocker, ticker, fee, markets): ( False, { - "best_pair": "XRP/BTC", - "best_rate": 1.0, - "best_pair_profit_ratio": 0.01, + "best_pair": "ETC/BTC", + "best_rate": 0.0, + "best_pair_profit_ratio": 0.00003860975, + "best_pair_profit_abs": 0.000584127, "profit_all_coin": -15.46546305, "profit_all_fiat": -190921.14135225, "profit_all_percent_mean": -49.62, @@ -1026,8 +1028,9 @@ def test_api_edge_disabled(botclient, mocker, ticker, fee, markets): None, { "best_pair": "XRP/BTC", - "best_rate": 1.0, - "best_pair_profit_ratio": 0.01, + "best_rate": 0.0, + "best_pair_profit_ratio": 0.000025203252, + "best_pair_profit_abs": 0.000155, "profit_all_coin": -14.87167525, "profit_all_fiat": -183590.83096125, "profit_all_percent_mean": 0.13, @@ -1080,7 +1083,8 @@ def test_api_profit(botclient, mocker, ticker, fee, markets, is_short, expected) assert rc.json() == { "avg_duration": ANY, "best_pair": expected["best_pair"], - "best_pair_profit_ratio": expected["best_pair_profit_ratio"], + "best_pair_profit_ratio": pytest.approx(expected["best_pair_profit_ratio"]), + "best_pair_profit_abs": expected["best_pair_profit_abs"], "best_rate": expected["best_rate"], "first_trade_date": ANY, "first_trade_humanized": ANY, diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index ccf81a0f0..1882e09c4 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -918,7 +918,7 @@ async def test_telegram_profit_handle( ) assert "∙ `6.253 USD`" in msg_mock.call_args_list[-1][0][0] - assert "*Best Performing:* `ETH/USDT: 9.45%`" in msg_mock.call_args_list[-1][0][0] + assert "*Best Performing:* `ETH/USDT: 5.685 USDT (9.47%)`" in msg_mock.call_args_list[-1][0][0] assert "*Max Drawdown:*" in msg_mock.call_args_list[-1][0][0] assert "*Profit factor:*" in msg_mock.call_args_list[-1][0][0] assert "*Winrate:*" in msg_mock.call_args_list[-1][0][0]