replaced mmr_key with unified maintenanceMarginRate

This commit is contained in:
Sam Germain 2022-02-09 04:57:43 -06:00
parent e987e0e2a9
commit fa2c9fc51f
2 changed files with 5 additions and 9 deletions

View File

@ -74,7 +74,6 @@ class Exchange:
"mark_ohlcv_price": "mark", "mark_ohlcv_price": "mark",
"mark_ohlcv_timeframe": "8h", "mark_ohlcv_timeframe": "8h",
"ccxt_futures_name": "swap", "ccxt_futures_name": "swap",
"mmr_key": None,
"can_fetch_multiple_tiers": True, "can_fetch_multiple_tiers": True,
} }
_ft_has: Dict = {} _ft_has: Dict = {}
@ -2284,6 +2283,7 @@ class Exchange:
raise OperationalException( raise OperationalException(
f"nominal value is required for {self.name}.get_maintenance_ratio_and_amt" f"nominal value is required for {self.name}.get_maintenance_ratio_and_amt"
) )
if self._api.has['fetchLeverageTiers']: if self._api.has['fetchLeverageTiers']:
if pair not in self._leverage_tiers: if pair not in self._leverage_tiers:
# Used when fetchLeverageTiers cannot fetch all symbols at once # Used when fetchLeverageTiers cannot fetch all symbols at once
@ -2298,15 +2298,12 @@ class Exchange:
# The lowest notional_floor for any pair in fetch_leverage_tiers is always 0 because it # The lowest notional_floor for any pair in fetch_leverage_tiers is always 0 because it
# describes the min amt for a tier, and the lowest tier will always go down to 0 # describes the min amt for a tier, and the lowest tier will always go down to 0
else: else:
info = self.markets[pair]['info'] mmr = self.markets[pair]['maintenanceMarginRate']
mmr_key = self._ft_has['mmr_key'] if mmr is None:
if mmr_key and mmr_key in info:
return (float(info[mmr_key]), None)
else:
raise OperationalException( raise OperationalException(
f"Cannot fetch maintenance margin. Dry-run for freqtrade {self.trading_mode}" f"Maintenance margin rate is unavailable for {self.name}"
f"is not available for {self.name}"
) )
return (mmr, None)
def is_exchange_known_ccxt(exchange_name: str, ccxt_module: CcxtModuleType = None) -> bool: def is_exchange_known_ccxt(exchange_name: str, ccxt_module: CcxtModuleType = None) -> bool:

View File

@ -23,7 +23,6 @@ class Gateio(Exchange):
_ft_has: Dict = { _ft_has: Dict = {
"ohlcv_candle_limit": 1000, "ohlcv_candle_limit": 1000,
"ohlcv_volume_currency": "quote", "ohlcv_volume_currency": "quote",
"mmr_key": "maintenance_rate",
} }
_headers = {'X-Gate-Channel-Id': 'freqtrade'} _headers = {'X-Gate-Channel-Id': 'freqtrade'}