Apply get_available_balance logic to regular trades, too
This commit is contained in:
parent
3c7981160c
commit
455838648d
@ -305,7 +305,7 @@ class FreqtradeBot:
|
|||||||
for the stake currency
|
for the stake currency
|
||||||
:return: float: Stake amount
|
: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:
|
if stake_amount is not None and available_amount < stake_amount:
|
||||||
raise DependencyException(
|
raise DependencyException(
|
||||||
|
@ -3628,6 +3628,7 @@ def test_sync_wallet_dry_run(mocker, default_conf, ticker, fee, limit_buy_order,
|
|||||||
# Initialize to 2 times stake amount
|
# Initialize to 2 times stake amount
|
||||||
default_conf['dry_run_wallet'] = 0.002
|
default_conf['dry_run_wallet'] = 0.002
|
||||||
default_conf['max_open_trades'] = 2
|
default_conf['max_open_trades'] = 2
|
||||||
|
default_conf['tradable_balance_ratio'] = 1.0
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
'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()
|
n = bot.enter_positions()
|
||||||
assert n == 0
|
assert n == 0
|
||||||
assert log_has_re(r"Unable to create trade for XRP/BTC: "
|
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)
|
caplog)
|
||||||
|
Loading…
Reference in New Issue
Block a user