From 14e857423528b87e0cbfd46f1e3ad2264cda8ccd Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 10 Apr 2021 14:13:00 +0200 Subject: [PATCH] fetch_balance is never called in dry-run --- freqtrade/exchange/exchange.py | 4 ---- tests/exchange/test_exchange.py | 15 --------------- 2 files changed, 19 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 7edace13c..3224255d0 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -662,8 +662,6 @@ class Exchange: @retrier def get_balance(self, currency: str) -> float: - if self._config['dry_run']: - return self._config['dry_run_wallet'] # ccxt exception is already handled by get_balances balances = self.get_balances() @@ -675,8 +673,6 @@ class Exchange: @retrier def get_balances(self) -> dict: - if self._config['dry_run']: - return {} try: balances = self._api.fetch_balance() diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index 202f1885f..4ceba6eba 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -1245,14 +1245,6 @@ def test_sell_considers_time_in_force(default_conf, mocker, exchange_name): assert "timeInForce" not in api_mock.create_order.call_args[0][5] -def test_get_balance_dry_run(default_conf, mocker): - default_conf['dry_run'] = True - default_conf['dry_run_wallet'] = 999.9 - - exchange = get_patched_exchange(mocker, default_conf) - assert exchange.get_balance(currency='BTC') == 999.9 - - @pytest.mark.parametrize("exchange_name", EXCHANGES) def test_get_balance_prod(default_conf, mocker, exchange_name): api_mock = MagicMock() @@ -1276,13 +1268,6 @@ def test_get_balance_prod(default_conf, mocker, exchange_name): exchange.get_balance(currency='BTC') -@pytest.mark.parametrize("exchange_name", EXCHANGES) -def test_get_balances_dry_run(default_conf, mocker, exchange_name): - default_conf['dry_run'] = True - exchange = get_patched_exchange(mocker, default_conf, id=exchange_name) - assert exchange.get_balances() == {} - - @pytest.mark.parametrize("exchange_name", EXCHANGES) def test_get_balances_prod(default_conf, mocker, exchange_name): balance_item = {