mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 18:23:55 +00:00
Merge pull request #2771 from freqtrade/fix/2770
Fix bad bug in safe_sell_amount
This commit is contained in:
commit
a20f502159
|
@ -903,8 +903,8 @@ class FreqtradeBot:
|
|||
:raise: DependencyException: if available balance is not within 2% of the available amount.
|
||||
"""
|
||||
wallet_amount = self.wallets.get_free(pair.split('/')[0])
|
||||
logger.debug(f"{pair} - Wallet: {wallet_amount} - Trade-amount: {amount}")
|
||||
if wallet_amount > amount:
|
||||
logger.info(f"Selling {pair} - Wallet: {wallet_amount} - Trade-amount: {amount}")
|
||||
if wallet_amount >= amount:
|
||||
return amount
|
||||
elif wallet_amount > amount * 0.98:
|
||||
logger.info(f"{pair} - Falling back to wallet-amount.")
|
||||
|
|
|
@ -2764,6 +2764,9 @@ def test__safe_sell_amount(default_conf, fee, caplog, mocker):
|
|||
|
||||
assert freqtrade._safe_sell_amount(trade.pair, trade.amount) == amount_wallet
|
||||
assert log_has_re(r'.*Falling back to wallet-amount.', caplog)
|
||||
caplog.clear()
|
||||
assert freqtrade._safe_sell_amount(trade.pair, amount_wallet) == amount_wallet
|
||||
assert not log_has_re(r'.*Falling back to wallet-amount.', caplog)
|
||||
|
||||
|
||||
def test__safe_sell_amount_error(default_conf, fee, caplog, mocker):
|
||||
|
|
Loading…
Reference in New Issue
Block a user