Update decorator locations

This commit is contained in:
Matthias 2022-02-15 07:04:50 +01:00
parent 324fdcedb1
commit 1bae18c60a
6 changed files with 9 additions and 6 deletions

View File

@ -246,6 +246,7 @@ class Binance(Exchange):
raise OperationalException( raise OperationalException(
"Freqtrade only supports isolated futures for leverage trading") "Freqtrade only supports isolated futures for leverage trading")
@retrier
def load_leverage_tiers(self) -> Dict[str, List[Dict]]: def load_leverage_tiers(self) -> Dict[str, List[Dict]]:
if self._config['dry_run']: if self._config['dry_run']:
leverage_tiers_path = ( leverage_tiers_path = (

View File

@ -1858,6 +1858,7 @@ class Exchange:
except ccxt.BaseError as e: except ccxt.BaseError as e:
raise OperationalException(e) from e raise OperationalException(e) from e
@retrier
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.exchange_has('fetchLeverageTiers'): if self.trading_mode == TradingMode.FUTURES and self.exchange_has('fetchLeverageTiers'):
try: try:
@ -1874,7 +1875,6 @@ class Exchange:
else: else:
return {} return {}
@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

View File

@ -4,6 +4,7 @@ from typing import Dict, List, Tuple
from freqtrade.enums import MarginMode, TradingMode from freqtrade.enums import MarginMode, TradingMode
from freqtrade.exceptions import OperationalException from freqtrade.exceptions import OperationalException
from freqtrade.exchange import Exchange from freqtrade.exchange import Exchange
from freqtrade.exchange.common import retrier
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -64,6 +65,7 @@ class Okx(Exchange):
pair_tiers = self._leverage_tiers[pair] pair_tiers = self._leverage_tiers[pair]
return pair_tiers[-1]['max'] / leverage return pair_tiers[-1]['max'] / leverage
@retrier
def load_leverage_tiers(self) -> Dict[str, List[Dict]]: def load_leverage_tiers(self) -> Dict[str, List[Dict]]:
# * This is slow(~45s) on Okex, must make 90-some api calls to load all linear swap markets # * This is slow(~45s) on Okex, must make 90-some api calls to load all linear swap markets
if self.trading_mode == TradingMode.FUTURES: if self.trading_mode == TradingMode.FUTURES:

View File

@ -846,7 +846,7 @@ def get_markets():
'option': False, 'option': False,
'active': True, 'active': True,
'contract': None, 'contract': None,
'linear': None, 'linear': True,
'inverse': None, 'inverse': None,
'taker': 0.0006, 'taker': 0.0006,
'maker': 0.0002, 'maker': 0.0002,
@ -891,8 +891,8 @@ def get_markets():
'future': True, 'future': True,
'swap': True, 'swap': True,
'margin': True, 'margin': True,
'linear': False, 'linear': True,
'inverse': True, 'inverse': False,
'type': 'spot', 'type': 'spot',
'contractSize': None, 'contractSize': None,
'taker': 0.0006, 'taker': 0.0006,

View File

@ -486,7 +486,7 @@ def test_fill_leverage_tiers_binance(default_conf, mocker):
api_mock, api_mock,
"binance", "binance",
"fill_leverage_tiers", "fill_leverage_tiers",
"fetch_leverage_tiers" "fetch_leverage_tiers",
) )

View File

@ -4247,7 +4247,7 @@ def test_load_leverage_tiers(mocker, default_conf, leverage_tiers):
mocker, mocker,
default_conf, default_conf,
api_mock, api_mock,
"binance", "ftx",
"load_leverage_tiers", "load_leverage_tiers",
"fetch_leverage_tiers", "fetch_leverage_tiers",
) )