Minimum re-entry stake should not include stoploss

This commit is contained in:
Matthias 2023-03-14 08:14:01 +01:00
parent 5c280d5649
commit 8f29312c9e
2 changed files with 12 additions and 4 deletions

View File

@ -586,7 +586,7 @@ class FreqtradeBot(LoggingMixin):
min_entry_stake = self.exchange.get_min_pair_stake_amount(trade.pair, min_entry_stake = self.exchange.get_min_pair_stake_amount(trade.pair,
current_entry_rate, current_entry_rate,
self.strategy.stoploss) 0.0)
min_exit_stake = self.exchange.get_min_pair_stake_amount(trade.pair, min_exit_stake = self.exchange.get_min_pair_stake_amount(trade.pair,
current_exit_rate, current_exit_rate,
self.strategy.stoploss) self.strategy.stoploss)
@ -700,7 +700,8 @@ class FreqtradeBot(LoggingMixin):
pos_adjust = trade is not None pos_adjust = trade is not None
enter_limit_requested, stake_amount, leverage = self.get_valid_enter_price_and_stake( enter_limit_requested, stake_amount, leverage = self.get_valid_enter_price_and_stake(
pair, price, stake_amount, trade_side, enter_tag, trade, order_adjust, leverage_) pair, price, stake_amount, trade_side, enter_tag, trade, order_adjust, leverage_,
pos_adjust)
if not stake_amount: if not stake_amount:
return False return False
@ -860,7 +861,12 @@ class FreqtradeBot(LoggingMixin):
trade: Optional[Trade], trade: Optional[Trade],
order_adjust: bool, order_adjust: bool,
leverage_: Optional[float], leverage_: Optional[float],
pos_adjust: bool,
) -> Tuple[float, float, float]: ) -> Tuple[float, float, float]:
"""
Validate and eventually adjust (within limits) limit, amount and leverage
:return: Tuple with (price, amount, leverage)
"""
if price: if price:
enter_limit_requested = price enter_limit_requested = price
@ -906,7 +912,9 @@ class FreqtradeBot(LoggingMixin):
# We do however also need min-stake to determine leverage, therefore this is ignored as # We do however also need min-stake to determine leverage, therefore this is ignored as
# edge-case for now. # edge-case for now.
min_stake_amount = self.exchange.get_min_pair_stake_amount( min_stake_amount = self.exchange.get_min_pair_stake_amount(
pair, enter_limit_requested, self.strategy.stoploss, leverage) pair, enter_limit_requested,
self.strategy.stoploss if not pos_adjust else 0.0,
leverage)
max_stake_amount = self.exchange.get_max_pair_stake_amount( max_stake_amount = self.exchange.get_max_pair_stake_amount(
pair, enter_limit_requested, leverage) pair, enter_limit_requested, leverage)

View File

@ -749,7 +749,7 @@ class Backtesting:
leverage = min(max(leverage, 1.0), max_leverage) leverage = min(max(leverage, 1.0), max_leverage)
min_stake_amount = self.exchange.get_min_pair_stake_amount( min_stake_amount = self.exchange.get_min_pair_stake_amount(
pair, propose_rate, -0.05, leverage=leverage) or 0 pair, propose_rate, -0.05 if not pos_adjust else 0.0, leverage=leverage) or 0
max_stake_amount = self.exchange.get_max_pair_stake_amount( max_stake_amount = self.exchange.get_max_pair_stake_amount(
pair, propose_rate, leverage=leverage) pair, propose_rate, leverage=leverage)
stake_available = self.wallets.get_available_stake_amount() stake_available = self.wallets.get_available_stake_amount()