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
|
raise OperationalException(e) from e
|
||||||
|
|
||||||
def load_leverage_tiers(self) -> Dict[str, List[Dict]]:
|
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()
|
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
|
@retrier
|
||||||
def fill_leverage_tiers(self) -> None:
|
def fill_leverage_tiers(self) -> None:
|
||||||
"""
|
"""
|
||||||
Assigns property _leverage_tiers to a dictionary of information about the leverage
|
Assigns property _leverage_tiers to a dictionary of information about the leverage
|
||||||
allowed on each pair
|
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()
|
leverage_tiers = self.load_leverage_tiers()
|
||||||
for pair, tiers in leverage_tiers.items():
|
for pair, tiers in leverage_tiers.items():
|
||||||
tiers = []
|
tiers = []
|
||||||
|
Loading…
Reference in New Issue
Block a user