Updated log messages for freqtradebot

This commit is contained in:
Sam Germain 2021-09-08 01:48:22 -06:00
parent 5184cc7749
commit 1379ec7402
2 changed files with 8 additions and 7 deletions

View File

@ -385,7 +385,7 @@ class FreqtradeBot(LoggingMixin):
logger.warning('Unable to create trade for %s: %s', pair, exception)
if not trades_created:
logger.debug("Found no buy signals for whitelisted currencies. Trying again...")
logger.debug("Found no enter signals for whitelisted currencies. Trying again...")
return trades_created
@ -681,7 +681,7 @@ class FreqtradeBot(LoggingMixin):
trades_closed += 1
except DependencyException as exception:
logger.warning('Unable to sell trade %s: %s', trade.pair, exception)
logger.warning('Unable to exit trade %s: %s', trade.pair, exception)
# Updating wallets if any trade occurred
if trades_closed:
@ -1062,7 +1062,7 @@ class FreqtradeBot(LoggingMixin):
return wallet_amount
else:
raise DependencyException(
f"Not enough amount to sell. Trade-amount: {amount}, Wallet: {wallet_amount}")
f"Not enough amount to exit trade. Trade-amount: {amount}, Wallet: {wallet_amount}")
def execute_trade_exit(self, trade: Trade, limit: float, sell_reason: SellCheckTuple) -> bool:
"""

View File

@ -1190,7 +1190,7 @@ def test_create_stoploss_order_invalid_order(mocker, default_conf, caplog, fee,
assert trade.stoploss_order_id is None
assert trade.sell_reason == SellType.EMERGENCY_SELL.value
assert log_has("Unable to place a stoploss order on exchange. ", caplog)
assert log_has("Selling the trade forcefully", caplog)
assert log_has("Exiting the trade forcefully", caplog)
# Should call a market sell
assert create_order_mock.call_count == 2
@ -1659,7 +1659,7 @@ def test_enter_positions(mocker, default_conf, caplog) -> None:
MagicMock(return_value=False))
n = freqtrade.enter_positions()
assert n == 0
assert log_has('Found no buy signals for whitelisted currencies. Trying again...', caplog)
assert log_has('Found no enter signals for whitelisted currencies. Trying again...', caplog)
# create_trade should be called once for every pair in the whitelist.
assert mock_ct.call_count == len(default_conf['exchange']['pair_whitelist'])
@ -1720,7 +1720,8 @@ def test_exit_positions_exception(mocker, default_conf, limit_buy_order, caplog)
)
n = freqtrade.exit_positions(trades)
assert n == 0
assert log_has('Unable to sell trade ETH/BTC: ', caplog)
assert log_has('Unable to exit trade ETH/BTC: ', caplog)
caplog.clear()
def test_update_trade_state(mocker, default_conf, limit_buy_order, caplog) -> None:
@ -3350,7 +3351,7 @@ def test__safe_sell_amount_error(default_conf, fee, caplog, mocker):
)
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
with pytest.raises(DependencyException, match=r"Not enough amount to sell."):
with pytest.raises(DependencyException, match=r"Not enough amount to exit."):
assert freqtrade._safe_sell_amount(trade.pair, trade.amount)