mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
fetch_balance is never called in dry-run
This commit is contained in:
parent
37c2e037f1
commit
14e8574235
|
@ -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()
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user