mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Log if no stake-amount is left for trade
This commit is contained in:
parent
cbdaaf705c
commit
ebcb530d4f
|
@ -598,6 +598,7 @@ class FreqtradeBot(LoggingMixin):
|
||||||
pair, price, stake_amount, trade_side, enter_tag, trade)
|
pair, price, stake_amount, trade_side, enter_tag, trade)
|
||||||
|
|
||||||
if not stake_amount:
|
if not stake_amount:
|
||||||
|
logger.info(f"No stake amount to enter a trade for {pair}.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if pos_adjust:
|
if pos_adjust:
|
||||||
|
|
|
@ -791,7 +791,7 @@ class RPC:
|
||||||
trade = Trade.get_trades([Trade.is_open.is_(True), Trade.pair == pair]).first()
|
trade = Trade.get_trades([Trade.is_open.is_(True), Trade.pair == pair]).first()
|
||||||
return trade
|
return trade
|
||||||
else:
|
else:
|
||||||
return None
|
raise RPCException(f'Failed to enter position for {pair}.')
|
||||||
|
|
||||||
def _rpc_delete(self, trade_id: int) -> Dict[str, Union[str, int]]:
|
def _rpc_delete(self, trade_id: int) -> Dict[str, Union[str, int]]:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1230,8 +1230,8 @@ def test_rpc_force_entry(mocker, default_conf, ticker, fee, limit_buy_order_open
|
||||||
patch_get_signal(freqtradebot)
|
patch_get_signal(freqtradebot)
|
||||||
rpc = RPC(freqtradebot)
|
rpc = RPC(freqtradebot)
|
||||||
pair = 'TKN/BTC'
|
pair = 'TKN/BTC'
|
||||||
trade = rpc._rpc_force_entry(pair, None)
|
with pytest.raises(RPCException, match=r"Failed to enter position for TKN/BTC."):
|
||||||
assert trade is None
|
trade = rpc._rpc_force_entry(pair, None)
|
||||||
|
|
||||||
|
|
||||||
def test_rpc_force_entry_stopped(mocker, default_conf) -> None:
|
def test_rpc_force_entry_stopped(mocker, default_conf) -> None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user