Merge pull request #2369 from freqtrade/disable_exchangevalidate

Allow skipping of exchange validation
This commit is contained in:
hroff-1902 2019-10-22 12:22:48 +03:00 committed by GitHub
commit 3cf95f9f6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View File

@ -165,7 +165,7 @@ class Exchange:
}
_ft_has: Dict = {}
def __init__(self, config: dict) -> None:
def __init__(self, config: dict, validate: bool = True) -> None:
"""
Initializes this module with the given config,
it does basic validation whether the specified exchange and pairs are valid.
@ -222,13 +222,13 @@ class Exchange:
# Converts the interval provided in minutes in config to seconds
self.markets_refresh_interval: int = exchange_config.get(
"markets_refresh_interval", 60) * 60
# Initial markets load
self._load_markets()
# Check if all pairs are available
self.validate_pairs(config['exchange']['pair_whitelist'])
self.validate_ordertypes(config.get('order_types', {}))
self.validate_order_time_in_force(config.get('order_time_in_force', {}))
if validate:
# Initial markets load
self._load_markets()
# Check if all pairs are available
self.validate_pairs(config['exchange']['pair_whitelist'])
self.validate_ordertypes(config.get('order_types', {}))
self.validate_order_time_in_force(config.get('order_time_in_force', {}))
def __del__(self):
"""

View File

@ -17,7 +17,7 @@ class ExchangeResolver(IResolver):
__slots__ = ['exchange']
def __init__(self, exchange_name: str, config: dict) -> None:
def __init__(self, exchange_name: str, config: dict, validate: bool = True) -> None:
"""
Load the custom class from config parameter
:param config: configuration dictionary
@ -26,7 +26,8 @@ class ExchangeResolver(IResolver):
exchange_name = MAP_EXCHANGE_CHILDCLASS.get(exchange_name, exchange_name)
exchange_name = exchange_name.title()
try:
self.exchange = self._load_exchange(exchange_name, kwargs={'config': config})
self.exchange = self._load_exchange(exchange_name, kwargs={'config': config,
'validate': validate})
except ImportError:
logger.info(
f"No {exchange_name} specific subclass found. Using the generic class instead.")
@ -45,7 +46,7 @@ class ExchangeResolver(IResolver):
try:
ex_class = getattr(exchanges, exchange_name)
exchange = ex_class(kwargs['config'])
exchange = ex_class(**kwargs)
if exchange:
logger.info(f"Using resolved exchange '{exchange_name}'...")
return exchange

View File

@ -122,7 +122,7 @@ def start_list_timeframes(args: Dict[str, Any]) -> None:
config['ticker_interval'] = None
# Init exchange
exchange = ExchangeResolver(config['exchange']['name'], config).exchange
exchange = ExchangeResolver(config['exchange']['name'], config, validate=False).exchange
if args['print_one_column']:
print('\n'.join(exchange.timeframes))