Removed leverage param from get_min_pair_stake_amount
This commit is contained in:
@@ -631,8 +631,12 @@ class Exchange:
|
||||
else:
|
||||
return 1 / pow(10, precision)
|
||||
|
||||
def get_min_pair_stake_amount(self, pair: str, price: float, stoploss: float,
|
||||
leverage: Optional[float] = 1.0) -> Optional[float]:
|
||||
def get_min_pair_stake_amount(
|
||||
self,
|
||||
pair: str,
|
||||
price: float,
|
||||
stoploss: float
|
||||
) -> Optional[float]:
|
||||
try:
|
||||
market = self.markets[pair]
|
||||
except KeyError:
|
||||
@@ -666,23 +670,11 @@ class Exchange:
|
||||
# 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 self._get_stake_amount_considering_leverage(
|
||||
self._contract_size_to_amount(
|
||||
pair,
|
||||
max(min_stake_amounts) * amount_reserve_percent
|
||||
),
|
||||
leverage or 1.0
|
||||
return self._contract_size_to_amount(
|
||||
pair,
|
||||
max(min_stake_amounts) * amount_reserve_percent
|
||||
)
|
||||
|
||||
def _get_stake_amount_considering_leverage(self, stake_amount: float, leverage: float):
|
||||
"""
|
||||
Takes the minimum stake amount for a pair with no leverage and returns the minimum
|
||||
stake amount when leverage is considered
|
||||
:param stake_amount: The stake amount for a pair before leverage is considered
|
||||
:param leverage: The amount of leverage being used on the current trade
|
||||
"""
|
||||
return stake_amount / leverage
|
||||
|
||||
# Dry-run methods
|
||||
|
||||
def create_dry_run_order(self, pair: str, ordertype: str, side: str, amount: float,
|
||||
@@ -840,15 +832,15 @@ class Exchange:
|
||||
|
||||
def _amount_to_contract_size(self, pair: str, amount: float):
|
||||
|
||||
if ('contractSize' in self._api.markets[pair]):
|
||||
return amount / self._api.markets[pair]['contractSize']
|
||||
if ('contractSize' in self.markets[pair]):
|
||||
return amount / self.markets[pair]['contractSize']
|
||||
else:
|
||||
return amount
|
||||
|
||||
def _contract_size_to_amount(self, pair: str, amount: float):
|
||||
|
||||
if ('contractSize' in self._api.markets[pair]):
|
||||
return amount * self._api.markets[pair]['contractSize']
|
||||
if ('contractSize' in self.markets[pair]):
|
||||
return amount * self.markets[pair]['contractSize']
|
||||
else:
|
||||
return amount
|
||||
|
||||
|
Reference in New Issue
Block a user