Fix calculation error for min-trade-stake

This commit is contained in:
Matthias
2021-03-20 07:21:22 +01:00
parent 0d5833ed91
commit 7ffe1fd36a
3 changed files with 34 additions and 9 deletions

View File

@@ -531,16 +531,16 @@ class Exchange:
return None
# reserve some percent defined in config (5% default) + stoploss
amount_reserve_percent = 1.0 - self._config.get('amount_reserve_percent',
amount_reserve_percent = 1.0 + self._config.get('amount_reserve_percent',
DEFAULT_AMOUNT_RESERVE_PERCENT)
amount_reserve_percent += stoploss
amount_reserve_percent += abs(stoploss)
# it should not be more than 50%
amount_reserve_percent = max(amount_reserve_percent, 0.5)
amount_reserve_percent = max(min(amount_reserve_percent, 1.5), 1)
# The value returned should satisfy both limits: for amount (base currency) and
# for cost (quote, stake currency), so max() is used here.
# See also #2575 at github.
return max(min_stake_amounts) / amount_reserve_percent
return max(min_stake_amounts) * amount_reserve_percent
def dry_run_order(self, pair: str, ordertype: str, side: str, amount: float,
rate: float, params: Dict = {}) -> Dict[str, Any]: