Repository: freqtrade/freqtrade

Issue:
List-timeframes validates whitelist and load markets
The `list-timeframes` command, when used with `--exchange` command (i.e. when used for exchange which is different from one, specified in the config) performs all the checks, that are needed for trading (validates whitelist, for example), loads markets (which also can fail for some exchanges) -- does many things that are needed for trading, but is redundant for the utility subcommands.

```
$ cp config_binance.json.example config.json
$ freqtrade list-timeframes --exchange bittrex
2019-10-12 11:38:23,040 - freqtrade.loggers - INFO - Verbosity set to 0
2019-10-12 11:38:23,041 - freqtrade.configuration.configuration - INFO - Dry run is enabled
2019-10-12 11:38:23,041 - freqtrade.configuration.configuration - INFO - Using DB: "sqlite://"
2019-10-12 11:38:23,041 - freqtrade.configuration.configuration - INFO - Using max_open_trades: 3 ...
2019-10-12 11:38:23,041 - freqtrade.configuration.configuration - INFO - Using exchange bittrex
2019-10-12 11:38:23,042 - freqtrade.configuration.configuration - INFO - Using user-data directory: /home/user/freqtrade-wrk/github-hroff-1902/freqtrade/user_data ...
2019-10-12 11:38:23,042 - freqtrade.configuration.configuration - INFO - Using data directory: /home/user/freqtrade-wrk/github-hroff-1902/freqtrade/user_data/data/bittrex ...
2019-10-12 11:38:23,042 - freqtrade.configuration.check_exchange - INFO - Checking exchange...
2019-10-12 11:38:23,043 - freqtrade.configuration.check_exchange - INFO - Exchange "bittrex" is officially supported by the Freqtrade development team.
2019-10-12 11:38:23,043 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
2019-10-12 11:38:23,043 - freqtrade.resolvers.exchange_resolver - INFO - No Bittrex specific subclass found. Using the generic class instead.
2019-10-12 11:38:23,043 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
2019-10-12 11:38:23,043 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
2019-10-12 11:38:23,046 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True, 'rateLimit': 200}
2019-10-12 11:38:23,060 - freqtrade.exchange.exchange - INFO - Using Exchange "Bittrex"
2019-10-12 11:38:25,255 - freqtrade - ERROR - Pair AST/BTC is not available on Bittrex. Please remove AST/BTC from your whitelist.
```

It should initialize and use a simplified variant of exchange object.



Discussion:
Expected behavior:
```
$ freqtrade list-timeframes --exchange bittrex
...
Timeframes available for the exchange `bittrex`: 1m, 5m, 30m, 1h, 1d
```

Resolving patch:
diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py
--- a/freqtrade/exchange/exchange.py
+++ b/freqtrade/exchange/exchange.py
@@ -155,7 +155,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.
@@ -209,13 +209,13 @@ def __init__(self, config: dict) -> None:
         # 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):
         """
diff --git a/freqtrade/resolvers/exchange_resolver.py b/freqtrade/resolvers/exchange_resolver.py
--- a/freqtrade/resolvers/exchange_resolver.py
+++ b/freqtrade/resolvers/exchange_resolver.py
@@ -17,14 +17,15 @@ 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
         """
         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.")
@@ -43,7 +44,7 @@ def _load_exchange(
         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
diff --git a/freqtrade/utils.py b/freqtrade/utils.py
--- a/freqtrade/utils.py
+++ b/freqtrade/utils.py
@@ -110,7 +110,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))


Test patch: