freqtrade.exchange edited load_leverage_tiers
This commit is contained in:
parent
0b717fbace
commit
41d8330fbc
@ -1857,31 +1857,27 @@ class Exchange:
|
||||
raise OperationalException(e) from e
|
||||
|
||||
def load_leverage_tiers(self) -> Dict[str, List[Dict]]:
|
||||
if self.trading_mode == TradingMode.FUTURES and self._api.has['fetchLeverageTiers']:
|
||||
try:
|
||||
return self._api.fetch_leverage_tiers()
|
||||
except ccxt.DDoSProtection as e:
|
||||
raise DDosProtection(e) from e
|
||||
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
|
||||
raise TemporaryError(
|
||||
f'Could not load leverage tiers due to {e.__class__.__name__}.'
|
||||
f'Message: {e}'
|
||||
) from e
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e) from e
|
||||
else:
|
||||
return {}
|
||||
|
||||
@retrier
|
||||
def fill_leverage_tiers(self) -> None:
|
||||
"""
|
||||
Assigns property _leverage_tiers to a dictionary of information about the leverage
|
||||
allowed on each pair
|
||||
After exectution, self._leverage_tiers = {
|
||||
"pair_name": [
|
||||
[notional_floor, maintenenace_margin_ratio, maintenance_amt],
|
||||
...
|
||||
],
|
||||
...
|
||||
}
|
||||
e.g. {
|
||||
"ETH/USDT:USDT": [
|
||||
[0.0, 0.01, 0.0],
|
||||
[10000, 0.02, 0.01],
|
||||
...
|
||||
],
|
||||
...
|
||||
}
|
||||
"""
|
||||
if self._api.has['fetchLeverageTiers']:
|
||||
if self.trading_mode == TradingMode.FUTURES:
|
||||
leverage_tiers = self.load_leverage_tiers()
|
||||
for pair, tiers in leverage_tiers.items():
|
||||
tiers = []
|
||||
|
Loading…
Reference in New Issue
Block a user