Allow skipping of exchange validation
This commit is contained in:
parent
31389b38f1
commit
f3f6e9d365
@ -155,7 +155,7 @@ class Exchange:
|
|||||||
}
|
}
|
||||||
_ft_has: Dict = {}
|
_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,
|
Initializes this module with the given config,
|
||||||
it does basic validation whether the specified exchange and pairs are valid.
|
it does basic validation whether the specified exchange and pairs are valid.
|
||||||
@ -209,9 +209,9 @@ class Exchange:
|
|||||||
# Converts the interval provided in minutes in config to seconds
|
# Converts the interval provided in minutes in config to seconds
|
||||||
self.markets_refresh_interval: int = exchange_config.get(
|
self.markets_refresh_interval: int = exchange_config.get(
|
||||||
"markets_refresh_interval", 60) * 60
|
"markets_refresh_interval", 60) * 60
|
||||||
|
if validate:
|
||||||
# Initial markets load
|
# Initial markets load
|
||||||
self._load_markets()
|
self._load_markets()
|
||||||
|
|
||||||
# Check if all pairs are available
|
# Check if all pairs are available
|
||||||
self.validate_pairs(config['exchange']['pair_whitelist'])
|
self.validate_pairs(config['exchange']['pair_whitelist'])
|
||||||
self.validate_ordertypes(config.get('order_types', {}))
|
self.validate_ordertypes(config.get('order_types', {}))
|
||||||
|
@ -17,14 +17,15 @@ class ExchangeResolver(IResolver):
|
|||||||
|
|
||||||
__slots__ = ['exchange']
|
__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
|
Load the custom class from config parameter
|
||||||
:param config: configuration dictionary
|
:param config: configuration dictionary
|
||||||
"""
|
"""
|
||||||
exchange_name = exchange_name.title()
|
exchange_name = exchange_name.title()
|
||||||
try:
|
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:
|
except ImportError:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"No {exchange_name} specific subclass found. Using the generic class instead.")
|
f"No {exchange_name} specific subclass found. Using the generic class instead.")
|
||||||
@ -43,7 +44,7 @@ class ExchangeResolver(IResolver):
|
|||||||
try:
|
try:
|
||||||
ex_class = getattr(exchanges, exchange_name)
|
ex_class = getattr(exchanges, exchange_name)
|
||||||
|
|
||||||
exchange = ex_class(kwargs['config'])
|
exchange = ex_class(**kwargs)
|
||||||
if exchange:
|
if exchange:
|
||||||
logger.info(f"Using resolved exchange '{exchange_name}'...")
|
logger.info(f"Using resolved exchange '{exchange_name}'...")
|
||||||
return exchange
|
return exchange
|
||||||
|
@ -110,7 +110,7 @@ def start_list_timeframes(args: Dict[str, Any]) -> None:
|
|||||||
config['ticker_interval'] = None
|
config['ticker_interval'] = None
|
||||||
|
|
||||||
# Init exchange
|
# Init exchange
|
||||||
exchange = ExchangeResolver(config['exchange']['name'], config).exchange
|
exchange = ExchangeResolver(config['exchange']['name'], config, validate=False).exchange
|
||||||
|
|
||||||
if args['print_one_column']:
|
if args['print_one_column']:
|
||||||
print('\n'.join(exchange.timeframes))
|
print('\n'.join(exchange.timeframes))
|
||||||
|
Loading…
Reference in New Issue
Block a user