test: update tests for new best-pair logic

This commit is contained in:
Matthias
2025-01-26 22:55:17 +01:00
parent 99b2857d3d
commit cf563c1a56
4 changed files with 26 additions and 22 deletions

View File

@@ -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"])

View File

@@ -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,

View File

@@ -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]