fetch_balance is never called in dry-run
This commit is contained in:
parent
37c2e037f1
commit
14e8574235
@ -662,8 +662,6 @@ class Exchange:
|
|||||||
|
|
||||||
@retrier
|
@retrier
|
||||||
def get_balance(self, currency: str) -> float:
|
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
|
# ccxt exception is already handled by get_balances
|
||||||
balances = self.get_balances()
|
balances = self.get_balances()
|
||||||
@ -675,8 +673,6 @@ class Exchange:
|
|||||||
|
|
||||||
@retrier
|
@retrier
|
||||||
def get_balances(self) -> dict:
|
def get_balances(self) -> dict:
|
||||||
if self._config['dry_run']:
|
|
||||||
return {}
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
balances = self._api.fetch_balance()
|
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]
|
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)
|
@pytest.mark.parametrize("exchange_name", EXCHANGES)
|
||||||
def test_get_balance_prod(default_conf, mocker, exchange_name):
|
def test_get_balance_prod(default_conf, mocker, exchange_name):
|
||||||
api_mock = MagicMock()
|
api_mock = MagicMock()
|
||||||
@ -1276,13 +1268,6 @@ def test_get_balance_prod(default_conf, mocker, exchange_name):
|
|||||||
exchange.get_balance(currency='BTC')
|
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)
|
@pytest.mark.parametrize("exchange_name", EXCHANGES)
|
||||||
def test_get_balances_prod(default_conf, mocker, exchange_name):
|
def test_get_balances_prod(default_conf, mocker, exchange_name):
|
||||||
balance_item = {
|
balance_item = {
|
||||||
|
Loading…
Reference in New Issue
Block a user