moved max_stake_amount check for None to exchange.get_max_pair_stake_amount
This commit is contained in:
parent
6b6b35ac1c
commit
8c680d75b9
@ -691,8 +691,13 @@ class Exchange:
|
||||
pair: str,
|
||||
price: float,
|
||||
stoploss: float
|
||||
) -> Optional[float]:
|
||||
return self._get_stake_amount_limit(pair, price, stoploss, 'max')
|
||||
) -> float:
|
||||
max_stake_amount = self._get_stake_amount_limit(pair, price, stoploss, 'max')
|
||||
if max_stake_amount is None:
|
||||
# * Should never be executed
|
||||
raise OperationalException(f'{self.name}.get_max_pair_stake_amount should'
|
||||
'never set max_stake_amount to None')
|
||||
return max_stake_amount
|
||||
|
||||
def _get_stake_amount_limit(
|
||||
self,
|
||||
|
@ -546,9 +546,6 @@ class FreqtradeBot(LoggingMixin):
|
||||
max_stake_amount = self.exchange.get_max_pair_stake_amount(trade.pair,
|
||||
current_rate,
|
||||
self.strategy.stoploss)
|
||||
if max_stake_amount is None:
|
||||
# * Should never be executed
|
||||
raise OperationalException(f'max_stake_amount is None for {trade}')
|
||||
stake_available = self.wallets.get_available_stake_amount()
|
||||
logger.debug(f"Calling adjust_trade_position for pair {trade.pair}")
|
||||
stake_amount = strategy_safe_wrapper(self.strategy.adjust_trade_position,
|
||||
@ -858,9 +855,6 @@ class FreqtradeBot(LoggingMixin):
|
||||
|
||||
if not self.edge and trade is None:
|
||||
stake_available = self.wallets.get_available_stake_amount()
|
||||
if max_stake_amount is None:
|
||||
# * Should never be executed
|
||||
raise OperationalException(f'max_stake_amount is None for {trade}')
|
||||
stake_amount = strategy_safe_wrapper(self.strategy.custom_stake_amount,
|
||||
default_retval=stake_amount)(
|
||||
pair=pair, current_time=datetime.now(timezone.utc),
|
||||
|
@ -414,9 +414,6 @@ class Backtesting:
|
||||
current_profit = trade.calc_profit_ratio(row[OPEN_IDX])
|
||||
min_stake = self.exchange.get_min_pair_stake_amount(trade.pair, row[OPEN_IDX], -0.1)
|
||||
max_stake = self.exchange.get_max_pair_stake_amount(trade.pair, row[OPEN_IDX], -0.1)
|
||||
if max_stake is None:
|
||||
# * Should never be executed
|
||||
raise OperationalException(f'max_stake_amount is None for {trade}')
|
||||
stake_available = self.wallets.get_available_stake_amount()
|
||||
stake_amount = strategy_safe_wrapper(self.strategy.adjust_trade_position,
|
||||
default_retval=None)(
|
||||
@ -557,9 +554,6 @@ class Backtesting:
|
||||
|
||||
min_stake_amount = self.exchange.get_min_pair_stake_amount(pair, propose_rate, -0.05) or 0
|
||||
max_stake_amount = self.exchange.get_max_pair_stake_amount(pair, propose_rate, -0.05) or 0
|
||||
if max_stake_amount is None:
|
||||
# * Should never be executed
|
||||
raise OperationalException(f'max_stake_amount is None for {trade}')
|
||||
stake_available = self.wallets.get_available_stake_amount()
|
||||
|
||||
pos_adjust = trade is not None
|
||||
|
Loading…
Reference in New Issue
Block a user