exchange.get_max_pair_stake_amount hard set leverage to 0

This commit is contained in:
Sam Germain
2022-02-04 14:26:15 -06:00
parent c0a593280e
commit 8b57827676
4 changed files with 22 additions and 26 deletions

View File

@@ -690,9 +690,8 @@ class Exchange:
self,
pair: str,
price: float,
stoploss: float
) -> float:
max_stake_amount = self._get_stake_amount_limit(pair, price, stoploss, 'max')
max_stake_amount = self._get_stake_amount_limit(pair, price, 0.0, 'max')
if max_stake_amount is None:
# * Should never be executed
raise OperationalException(f'{self.name}.get_max_pair_stake_amount should'

View File

@@ -543,9 +543,7 @@ class FreqtradeBot(LoggingMixin):
min_stake_amount = self.exchange.get_min_pair_stake_amount(trade.pair,
current_rate,
self.strategy.stoploss)
max_stake_amount = self.exchange.get_max_pair_stake_amount(trade.pair,
current_rate,
self.strategy.stoploss)
max_stake_amount = self.exchange.get_max_pair_stake_amount(trade.pair, current_rate)
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,
@@ -852,8 +850,7 @@ class FreqtradeBot(LoggingMixin):
# edge-case for now.
min_stake_amount = self.exchange.get_min_pair_stake_amount(
pair, enter_limit_requested, self.strategy.stoploss)
max_stake_amount = self.exchange.get_max_pair_stake_amount(
pair, enter_limit_requested, self.strategy.stoploss)
max_stake_amount = self.exchange.get_max_pair_stake_amount(pair, enter_limit_requested)
if not self.edge and trade is None:
stake_available = self.wallets.get_available_stake_amount()

View File

@@ -417,7 +417,7 @@ class Backtesting:
# TODO: Write tests
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)
max_stake = self.exchange.get_max_pair_stake_amount(trade.pair, row[OPEN_IDX])
stake_available = self.wallets.get_available_stake_amount()
stake_amount = strategy_safe_wrapper(self.strategy.adjust_trade_position,
default_retval=None)(
@@ -557,7 +557,7 @@ class Backtesting:
propose_rate = min(max(propose_rate, row[LOW_IDX]), row[HIGH_IDX])
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)
max_stake_amount = self.exchange.get_max_pair_stake_amount(pair, propose_rate)
stake_available = self.wallets.get_available_stake_amount()
pos_adjust = trade is not None