diff --git a/tests/rpc/test_rpc.py b/tests/rpc/test_rpc.py index 225c5e364..9bb8d64ea 100644 --- a/tests/rpc/test_rpc.py +++ b/tests/rpc/test_rpc.py @@ -680,8 +680,8 @@ def test_rpc_balance_handle(default_conf_usdt, mocker, tickers): ] assert pytest.approx(result["total_bot"]) == 69.5 assert pytest.approx(result["total"]) == 2824.83464 # ETH stake is missing. - assert result["starting_capital"] == 50 - assert result["starting_capital_ratio"] == pytest.approx(0.3899999) + assert result["starting_capital"] == 50 * default_conf_usdt["tradable_balance_ratio"] + assert result["starting_capital_ratio"] == pytest.approx(0.4040404) def test_rpc_start(mocker, default_conf) -> None: diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 221a8b666..de3472885 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -1056,6 +1056,7 @@ def test_api_edge_disabled(botclient, mocker, ticker, fee, markets): ) def test_api_profit(botclient, mocker, ticker, fee, markets, is_short, expected): ftbot, client = botclient + ftbot.config["tradable_balance_ratio"] = 1 patch_get_signal(ftbot) mocker.patch.multiple( EXMS, diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index 845bce37c..b71b3975e 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -1087,7 +1087,7 @@ async def test_balance_handle_empty_response_dry(default_conf, update, mocker) - result = msg_mock.call_args_list[0][0][0] assert msg_mock.call_count == 1 assert "*Warning:* Simulated balances in Dry Mode." in result - assert "Starting capital: `1000 BTC`" in result + assert "Starting capital: `990 BTC`" in result async def test_balance_handle_too_large_response(default_conf, update, mocker) -> None: diff --git a/tests/test_wallets.py b/tests/test_wallets.py index 36211dcab..002e27c18 100644 --- a/tests/test_wallets.py +++ b/tests/test_wallets.py @@ -244,7 +244,7 @@ def test_get_starting_balance( freqtrade = get_patched_freqtradebot(mocker, default_conf) - assert freqtrade.wallets.get_starting_balance() == expected + assert freqtrade.wallets.get_starting_balance() == expected * (1 if available_capital else 0.99) def test_sync_wallet_futures_live(mocker, default_conf): @@ -373,7 +373,10 @@ def test_sync_wallet_dry(mocker, default_conf_usdt, fee): # sum of used and free should be total. assert usdt_bal.total == usdt_bal.free + usdt_bal.used - assert freqtrade.wallets.get_starting_balance() == default_conf_usdt["dry_run_wallet"] + assert ( + freqtrade.wallets.get_starting_balance() + == default_conf_usdt["dry_run_wallet"] * default_conf_usdt["tradable_balance_ratio"] + ) total = freqtrade.wallets.get_total("LTC") free = freqtrade.wallets.get_free("LTC") used = freqtrade.wallets.get_used("LTC") @@ -401,7 +404,10 @@ def test_sync_wallet_futures_dry(mocker, default_conf, fee): assert positions["XRP/BTC"].side == "long" assert positions["LTC/BTC"].side == "short" - assert freqtrade.wallets.get_starting_balance() == default_conf["dry_run_wallet"] + assert ( + freqtrade.wallets.get_starting_balance() + == default_conf["dry_run_wallet"] * default_conf["tradable_balance_ratio"] + ) total = freqtrade.wallets.get_total("BTC") free = freqtrade.wallets.get_free("BTC") used = freqtrade.wallets.get_used("BTC")