mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 02:12:01 +00:00
Don't load leverage tiers when not necessary
This commit is contained in:
parent
7682c9ace7
commit
2eb1d18c2a
|
@ -88,7 +88,8 @@ class Exchange:
|
|||
# TradingMode.SPOT always supported and not required in this list
|
||||
]
|
||||
|
||||
def __init__(self, config: Dict[str, Any], validate: bool = True) -> None:
|
||||
def __init__(self, config: Dict[str, Any], validate: bool = True,
|
||||
load_leverage_tiers: bool = False) -> None:
|
||||
"""
|
||||
Initializes this module with the given config,
|
||||
it does basic validation whether the specified exchange and pairs are valid.
|
||||
|
@ -186,7 +187,7 @@ class Exchange:
|
|||
self.markets_refresh_interval: int = exchange_config.get(
|
||||
"markets_refresh_interval", 60) * 60
|
||||
|
||||
if self.trading_mode != TradingMode.SPOT:
|
||||
if self.trading_mode != TradingMode.SPOT and load_leverage_tiers:
|
||||
self.fill_leverage_tiers()
|
||||
self.additional_exchange_init()
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ class FreqtradeBot(LoggingMixin):
|
|||
# Check config consistency here since strategies can set certain options
|
||||
validate_config_consistency(config)
|
||||
|
||||
self.exchange = ExchangeResolver.load_exchange(self.config['exchange']['name'], self.config)
|
||||
self.exchange = ExchangeResolver.load_exchange(
|
||||
self.config['exchange']['name'], self.config, load_leverage_tiers=True)
|
||||
|
||||
init_db(self.config['db_url'])
|
||||
|
||||
|
|
|
@ -84,7 +84,8 @@ class Backtesting:
|
|||
self.processed_dfs: Dict[str, Dict] = {}
|
||||
|
||||
self._exchange_name = self.config['exchange']['name']
|
||||
self.exchange = ExchangeResolver.load_exchange(self._exchange_name, self.config)
|
||||
self.exchange = ExchangeResolver.load_exchange(
|
||||
self._exchange_name, self.config, load_leverage_tiers=True)
|
||||
self.dataprovider = DataProvider(self.config, self.exchange)
|
||||
|
||||
if self.config.get('strategy_list'):
|
||||
|
|
|
@ -18,7 +18,8 @@ class ExchangeResolver(IResolver):
|
|||
object_type = Exchange
|
||||
|
||||
@staticmethod
|
||||
def load_exchange(exchange_name: str, config: dict, validate: bool = True) -> Exchange:
|
||||
def load_exchange(exchange_name: str, config: dict, validate: bool = True,
|
||||
load_leverage_tiers: bool = False) -> Exchange:
|
||||
"""
|
||||
Load the custom class from config parameter
|
||||
:param exchange_name: name of the Exchange to load
|
||||
|
@ -29,9 +30,13 @@ class ExchangeResolver(IResolver):
|
|||
exchange_name = exchange_name.title()
|
||||
exchange = None
|
||||
try:
|
||||
exchange = ExchangeResolver._load_exchange(exchange_name,
|
||||
kwargs={'config': config,
|
||||
'validate': validate})
|
||||
exchange = ExchangeResolver._load_exchange(
|
||||
exchange_name,
|
||||
kwargs={
|
||||
'config': config,
|
||||
'validate': validate,
|
||||
'load_leverage_tiers': load_leverage_tiers}
|
||||
)
|
||||
except ImportError:
|
||||
logger.info(
|
||||
f"No {exchange_name} specific subclass found. Using the generic class instead.")
|
||||
|
|
|
@ -37,7 +37,7 @@ def get_exchange(config=Depends(get_config)):
|
|||
if not ApiServer._exchange:
|
||||
from freqtrade.resolvers import ExchangeResolver
|
||||
ApiServer._exchange = ExchangeResolver.load_exchange(
|
||||
config['exchange']['name'], config)
|
||||
config['exchange']['name'], config, load_leverage_tiers=False)
|
||||
return ApiServer._exchange
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user