Apply get_available_balance logic to regular trades, too

This commit is contained in:
Matthias 2020-01-03 10:41:10 +01:00
parent 3c7981160c
commit 455838648d
2 changed files with 3 additions and 2 deletions

View File

@ -305,7 +305,7 @@ class FreqtradeBot:
for the stake currency
:return: float: Stake amount
"""
available_amount = self.wallets.get_free(self.config['stake_currency'])
available_amount = self._get_available_stake_amount()
if stake_amount is not None and available_amount < stake_amount:
raise DependencyException(

View File

@ -3628,6 +3628,7 @@ def test_sync_wallet_dry_run(mocker, default_conf, ticker, fee, limit_buy_order,
# Initialize to 2 times stake amount
default_conf['dry_run_wallet'] = 0.002
default_conf['max_open_trades'] = 2
default_conf['tradable_balance_ratio'] = 1.0
patch_exchange(mocker)
mocker.patch.multiple(
'freqtrade.exchange.Exchange',
@ -3649,5 +3650,5 @@ def test_sync_wallet_dry_run(mocker, default_conf, ticker, fee, limit_buy_order,
n = bot.enter_positions()
assert n == 0
assert log_has_re(r"Unable to create trade for XRP/BTC: "
r"Available balance \(0 BTC\) is lower than stake amount \(0.001 BTC\)",
r"Available balance \(0.0 BTC\) is lower than stake amount \(0.001 BTC\)",
caplog)