exchange.get_max_leverage de-complex

This commit is contained in:
Sam Germain 2022-02-10 04:06:02 -06:00
parent 9e599455e7
commit 60a45ff394

View File

@ -1935,19 +1935,16 @@ class Exchange:
) )
if pair not in self._leverage_tiers: if pair not in self._leverage_tiers:
tiers = self.get_leverage_tiers_for_pair(pair) self.get_leverage_tiers_for_pair(pair)
if not tiers: # Not a leveraged market
return 1.0
if stake_amount == 0:
return self._leverage_tiers[pair][0]['lev'] # Max lev for lowest amount
pair_tiers = self._leverage_tiers[pair] pair_tiers = self._leverage_tiers[pair]
num_tiers = len(pair_tiers) num_tiers = len(pair_tiers)
if num_tiers < 1: if num_tiers < 1:
return 1.0 return 1.0
if stake_amount == 0:
return self._leverage_tiers[pair][0]['lev'] # Max lev for lowest amount
for tier_index in range(num_tiers): for tier_index in range(num_tiers):
tier = pair_tiers[tier_index] tier = pair_tiers[tier_index]