Repository: freqtrade/freqtrade

Issue:
Inconsistent behaviour when retrieving exchange data: why?
## Environment description:
  * Operating system: windows 10 running wsl2 in ubuntu
  * Python Version: Python 3.8.3
  * CCXT version: ccxt==1.35.17
  * Freqtrade Version: freqtrade 2020.9.1

## Problem description:
I'm trying to download data from one exchange, and it seems to be a problem with BTC to USD market.

Because I'm mainly testing on Bitstap, I also use Binance as proof check, because Bitstamp is not supported in full.

Depending the pair downloaded, I get inconsistent answers.

In order to run this test, I check the markets available on both exchanges, just to be on the safe side. Running the following commands confirms me that the market I'm looking for is available.

`freqtrade list-markets --exchange bitstamp --config freqtrade/config.json`
yields (among others):
>+---------+----------+--------+---------+----------+-----------+
>|      Id |   Symbol |   Base |   Quote |   Active |   Is pair |
>|---------+----------+--------+---------+----------+-----------|
>[...]
>|  btcusd |  BTC/USD |    BTC |     USD |     True |      True |
>[...]
>|  ethbtc |  ETH/BTC |    ETH |     BTC |     True |      True |
>[...]
>|  xrpbtc |  XRP/BTC |    XRP |     BTC |     True |      True |

`freqtrade list-markets --exchange binance --config freqtrade/config.json`
yields (among others):
>+---------+----------+--------+---------+----------+-----------+
>|      Id |   Symbol |   Base |   Quote |   Active |   Is pair |
>|---------+----------+--------+---------+----------+-----------|
>[...]
>|      BTCUSDC |      BTC/USDC |      BTC |    USDC |     True |      True |
>[...]
>|       ETHBTC |       ETH/BTC |      ETH |     BTC |     True |      True |
>[...]
>|       XRPBTC |       XRP/BTC |      XRP |     BTC |     True |      True |

So, I would expect that running the following commands I should be able to get all the results I need:
`freqtrade download-data --pairs ETH/BTC --exchange binance --days 5 -t 1h --config freqtrade/config.json`
`freqtrade download-data --pairs ETH/BTC --exchange bitstamp --days 5 -t 1h --config freqtrade/config.json`
`freqtrade download-data --pairs BTC/USDC --exchange binance --days 5 -t 1h --config freqtrade/config.json`
`freqtrade download-data --pairs BTC/USD --exchange bitstamp --days 5 -t 1h --config freqtrade/config.json`

What happens, in reality, is that only the two first commands yield a download result. The second two return an error:
>freqtrade - ERROR - Stake-currency 'BTC' not compatible with pair-whitelist. Please remove the following pairs: ['BTC/USD']
>freqtrade - ERROR - Stake-currency 'BTC' not compatible with pair-whitelist. Please remove the following pairs: ['BTC/USDC']

### Steps to reproduce:
`freqtrade download-data --pairs BTC/USDC --exchange binance --days 5 -t 1h --config freqtrade/config.json`
`freqtrade download-data --pairs BTC/USD --exchange bitstamp --days 5 -t 1h --config freqtrade/config.json`

### Observed Results:
No list is retrieved.

### Relevant code exceptions or logs:
Sligthly redacted to simplify reading
`freqtrade download-data --pairs ETH/BTC --exchange binance --days 5 -t 1h --config freqtrade/config.json`
>2020-10-29 05:47:04,911 - freqtrade.configuration.configuration - INFO - Using config: freqtrade/config.json ...
>2020-10-29 05:47:04,911 - freqtrade.loggers - INFO - Verbosity set to 0
>2020-10-29 05:47:04,911 - freqtrade.configuration.configuration - INFO - Using exchange binance
>2020-10-29 05:47:04,912 - freqtrade.configuration.configuration - INFO - Using user-data directory: /home/myusername/user_data ...
>2020-10-29 05:47:04,912 - freqtrade.configuration.configuration - INFO - Using data directory: /home/myusername/user_data/data/binance ...
>2020-10-29 05:47:04,912 - freqtrade.configuration.configuration - INFO - Using pairs ['ETH/BTC']
>2020-10-29 05:47:04,912 - freqtrade.configuration.configuration - INFO - timeframes --timeframes: ['1h']
>2020-10-29 05:47:04,912 - freqtrade.configuration.configuration - INFO - Detected --days: 5
>2020-10-29 05:47:04,912 - freqtrade.configuration.configuration - INFO - Using "json" to store OHLCV data.
>2020-10-29 05:47:04,912 - freqtrade.configuration.configuration - INFO - Using "jsongz" to store trades data.
>2020-10-29 05:47:04,912 - freqtrade.configuration.check_exchange - INFO - Checking exchange...
>2020-10-29 05:47:04,912 - freqtrade.configuration.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team.
>2020-10-29 05:47:04,913 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
>2020-10-29 05:47:04,916 - freqtrade.commands.data_commands - INFO - About to download pairs: ['ETH/BTC'], intervals: ['1h'] to /home/myusername/user_data/data/binance
>2020-10-29 05:47:04,916 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
>2020-10-29 05:47:04,916 - freqtrade.exchange.exchange - INFO - Using CCXT 1.35.17
>2020-10-29 05:47:04,916 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
>2020-10-29 05:47:04,921 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
>2020-10-29 05:47:04,926 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
>2020-10-29 05:47:04,927 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'...
>2020-10-29 05:47:04,927 - freqtrade.exchange.exchange - INFO - Markets were not loaded. Loading them now..
>2020-10-29 05:47:06,557 - freqtrade.data.history.history_utils - INFO - Downloading pair ETH/BTC, interval 1h.
>2020-10-29 05:47:06,557 - freqtrade.data.history.history_utils - INFO - Download history data for pair: "ETH/BTC", timeframe: 1h and store in /home/myusername/user_data/data/binance.
>2020-10-29 05:47:06,563 - numexpr.utils - INFO - NumExpr defaulting to 8 threads.
>2020-10-29 05:47:06,848 - freqtrade.exchange.exchange - INFO - Downloaded data for ETH/BTC with length 3.

`freqtrade download-data --pairs ETH/BTC --exchange bitstamp --days 5 -t 1h --config freqtrade/config.json`
>2020-10-29 05:47:28,696 - freqtrade.configuration.configuration - INFO - Using config: freqtrade/config.json ...
>2020-10-29 05:47:28,697 - freqtrade.loggers - INFO - Verbosity set to 0
>2020-10-29 05:47:28,697 - freqtrade.configuration.configuration - INFO - Using exchange bitstamp
>2020-10-29 05:47:28,698 - freqtrade.configuration.configuration - INFO - Using user-data directory: /home/myusername/user_data ...
>2020-10-29 05:47:28,698 - freqtrade.configuration.configuration - INFO - Using data directory: /home/myusername/user_data/data/bitstamp ...
>2020-10-29 05:47:28,698 - freqtrade.configuration.configuration - INFO - Using pairs ['ETH/BTC']
>2020-10-29 05:47:28,698 - freqtrade.configuration.configuration - INFO - timeframes --timeframes: ['1h']
>2020-10-29 05:47:28,698 - freqtrade.configuration.configuration - INFO - Detected --days: 5
>2020-10-29 05:47:28,698 - freqtrade.configuration.configuration - INFO - Using "json" to store OHLCV data.
>2020-10-29 05:47:28,699 - freqtrade.configuration.configuration - INFO - Using "jsongz" to store trades data.
>2020-10-29 05:47:28,699 - freqtrade.configuration.check_exchange - INFO - Checking exchange...
>2020-10-29 05:47:28,699 - freqtrade.configuration.check_exchange - WARNING - Exchange "bitstamp" is known to the the ccxt library, available for the bot, but not officially supported by the Freqtrade development team. It may work flawlessly (please report back) or have serious issues. Use it at your own discretion.
>2020-10-29 05:47:28,699 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
>2020-10-29 05:47:28,703 - freqtrade.commands.data_commands - INFO - About to download pairs: ['ETH/BTC'], intervals: ['1h'] to /home/myusername/user_data/data/bitstamp
>2020-10-29 05:47:28,703 - freqtrade.resolvers.exchange_resolver - INFO - No Bitstamp specific subclass found. Using the generic class instead.
>2020-10-29 05:47:28,703 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
>2020-10-29 05:47:28,703 - freqtrade.exchange.exchange - INFO - Using CCXT 1.35.17
>2020-10-29 05:47:28,703 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
>2020-10-29 05:47:28,706 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
>2020-10-29 05:47:28,708 - freqtrade.exchange.exchange - INFO - Using Exchange "Bitstamp"
>2020-10-29 05:47:28,708 - freqtrade.exchange.exchange - INFO - Markets were not loaded. Loading them now..
>2020-10-29 05:47:29,149 - freqtrade.data.history.history_utils - INFO - Downloading pair ETH/BTC, interval 1h.
>2020-10-29 05:47:29,149 - freqtrade.data.history.history_utils - INFO - Download history data for pair: "ETH/BTC", timeframe: 1h and store in /home/myusername/user_data/data/bitstamp.
>2020-10-29 05:47:29,155 - numexpr.utils - INFO - NumExpr defaulting to 8 threads.
>2020-10-29 05:47:29,789 - freqtrade.exchange.exchange - INFO - Downloaded data for ETH/BTC with length 2.

`freqtrade download-data --pairs BTC/USDC --exchange binance --days 5 -t 1h --config freqtrade/config.json`
>2020-10-29 05:47:43,816 - freqtrade.configuration.configuration - INFO - Using config: freqtrade/config.json ...
>2020-10-29 05:47:43,817 - freqtrade.loggers - INFO - Verbosity set to 0
>2020-10-29 05:47:43,818 - freqtrade.configuration.configuration - INFO - Using exchange binance
>2020-10-29 05:47:43,818 - freqtrade.configuration.configuration - INFO - Using user-data directory: /home/myusername/user_data ...
>2020-10-29 05:47:43,818 - freqtrade.configuration.configuration - INFO - Using data directory: /home/myusername/user_data/data/binance ...
>2020-10-29 05:47:43,819 - freqtrade.configuration.configuration - INFO - Using pairs ['BTC/USDC']
>2020-10-29 05:47:43,819 - freqtrade.configuration.configuration - INFO - timeframes --timeframes: ['1h']
>2020-10-29 05:47:43,819 - freqtrade.configuration.configuration - INFO - Detected --days: 5
>2020-10-29 05:47:43,819 - freqtrade.configuration.configuration - INFO - Using "json" to store OHLCV data.
>2020-10-29 05:47:43,819 - freqtrade.configuration.configuration - INFO - Using "jsongz" to store trades data.
>2020-10-29 05:47:43,819 - freqtrade.configuration.check_exchange - INFO - Checking exchange...
>2020-10-29 05:47:43,819 - freqtrade.configuration.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team.
>2020-10-29 05:47:43,819 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
>2020-10-29 05:47:43,824 - freqtrade.commands.data_commands - INFO - About to download pairs: ['BTC/USDC'], intervals: ['1h'] to /home/myusername/user_data/data/binance
>2020-10-29 05:47:43,824 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
>2020-10-29 05:47:43,824 - freqtrade.exchange.exchange - INFO - Using CCXT 1.35.17
>2020-10-29 05:47:43,824 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
>2020-10-29 05:47:43,829 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
>2020-10-29 05:47:43,833 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
>2020-10-29 05:47:43,833 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'...
>2020-10-29 05:47:43,833 - freqtrade.exchange.exchange - INFO - Markets were not loaded. Loading them now..
>2020-10-29 05:47:44,765 - freqtrade - ERROR - Stake-currency 'BTC' not compatible with pair-whitelist. Please remove the following pairs: ['BTC/USDC']

`freqtrade download-data --pairs BTC/USD --exchange bitstamp --days 5 -t 1h --config freqtrade/config.json`
>2020-10-29 05:47:58,470 - freqtrade.configuration.configuration - INFO - Using config: freqtrade/config.json ...
>2020-10-29 05:47:58,471 - freqtrade.loggers - INFO - Verbosity set to 0
>2020-10-29 05:47:58,471 - freqtrade.configuration.configuration - INFO - Using exchange bitstamp
>2020-10-29 05:47:58,471 - freqtrade.configuration.configuration - INFO - Using user-data directory: /home/myusername/user_data ...
>2020-10-29 05:47:58,471 - freqtrade.configuration.configuration - INFO - Using data directory: /home/myusername/user_data/data/bitstamp ...
>2020-10-29 05:47:58,471 - freqtrade.configuration.configuration - INFO - Using pairs ['BTC/USD']
>2020-10-29 05:47:58,471 - freqtrade.configuration.configuration - INFO - timeframes --timeframes: ['1h']
>2020-10-29 05:47:58,471 - freqtrade.configuration.configuration - INFO - Detected --days: 5
>2020-10-29 05:47:58,471 - freqtrade.configuration.configuration - INFO - Using "json" to store OHLCV data.
>2020-10-29 05:47:58,472 - freqtrade.configuration.configuration - INFO - Using "jsongz" to store trades data.
>2020-10-29 05:47:58,472 - freqtrade.configuration.check_exchange - INFO - Checking exchange...
>2020-10-29 05:47:58,472 - freqtrade.configuration.check_exchange - WARNING - Exchange "bitstamp" is known to the the ccxt library, available for the bot, but not officially supported by the Freqtrade development team. It may work flawlessly (please report back) or have serious issues. Use it at your own discretion.
>2020-10-29 05:47:58,472 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
>2020-10-29 05:47:58,475 - freqtrade.commands.data_commands - INFO - About to download pairs: ['BTC/USD'], intervals: ['1h'] to /home/myusername/user_data/data/bitstamp
>2020-10-29 05:47:58,475 - freqtrade.resolvers.exchange_resolver - INFO - No Bitstamp specific subclass found. Using the generic class instead.
>2020-10-29 05:47:58,476 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
>2020-10-29 05:47:58,476 - freqtrade.exchange.exchange - INFO - Using CCXT 1.35.17
>2020-10-29 05:47:58,476 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
>2020-10-29 05:47:58,478 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
>2020-10-29 05:47:58,481 - freqtrade.exchange.exchange - INFO - Using Exchange "Bitstamp"
>2020-10-29 05:47:58,481 - freqtrade.exchange.exchange - INFO - Markets were not loaded. Loading them now..
>2020-10-29 05:47:58,926 - freqtrade - ERROR - Stake-currency 'BTC' not compatible with pair-whitelist. Please remove the following pairs: ['BTC/USD']

###Additional files
Here you can find my config.json 
[config.json.txt](https://github.com/freqtrade/freqtrade/files/5456283/config.json.txt)



Discussion:
when you're using download-data with a configuration file, it's best to set stake-currency to empty in the configuration.

```
...
   "stake_currency": "",
...
```

it's kindof known to me for a while now that this happens (the problem is the validation of the "to download pairs" against stake-currency) - but so far i did lack the time to properly fix this - as we don't want to disable all validation, as other parts (like validating that the timeframes you provided are valid for this exchange) do make sense.

Resolving patch:
diff --git a/freqtrade/commands/data_commands.py b/freqtrade/commands/data_commands.py
--- a/freqtrade/commands/data_commands.py
+++ b/freqtrade/commands/data_commands.py
@@ -35,6 +35,9 @@ def start_download_data(args: Dict[str, Any]) -> None:
     if 'timerange' in config:
         timerange = timerange.parse_timerange(config['timerange'])
 
+    # Remove stake-currency to skip checks which are not relevant for datadownload
+    config['stake_currency'] = ''
+
     if 'pairs' not in config:
         raise OperationalException(
             "Downloading data requires a list of pairs. "
diff --git a/freqtrade/commands/deploy_commands.py b/freqtrade/commands/deploy_commands.py
--- a/freqtrade/commands/deploy_commands.py
+++ b/freqtrade/commands/deploy_commands.py
@@ -133,7 +133,7 @@ def start_new_hyperopt(args: Dict[str, Any]) -> None:
 
         if new_path.exists():
             raise OperationalException(f"`{new_path}` already exists. "
-                                       "Please choose another Strategy Name.")
+                                       "Please choose another Hyperopt Name.")
         deploy_new_hyperopt(args['hyperopt'], new_path, args['template'])
     else:
         raise OperationalException("`new-hyperopt` requires --hyperopt to be set.")


Test patch:
diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py
--- a/tests/commands/test_commands.py
+++ b/tests/commands/test_commands.py
@@ -435,6 +435,16 @@ def test_list_markets(mocker, markets, capsys):
     assert re.search(r"^BLK/BTC$", captured.out, re.MULTILINE)
     assert re.search(r"^LTC/USD$", captured.out, re.MULTILINE)
 
+    mocker.patch('freqtrade.exchange.Exchange.markets', PropertyMock(side_effect=ValueError))
+    # Test --one-column
+    args = [
+        "list-markets",
+        '--config', 'config.json.example',
+        "--one-column"
+    ]
+    with pytest.raises(OperationalException, match=r"Cannot get markets.*"):
+        start_list_markets(get_args(args), False)
+
 
 def test_create_datadir_failed(caplog):
 
@@ -476,6 +486,12 @@ def test_start_new_strategy(mocker, caplog):
     assert "CoolNewStrategy" in wt_mock.call_args_list[0][0][0]
     assert log_has_re("Writing strategy to .*", caplog)
 
+    mocker.patch('freqtrade.commands.deploy_commands.setup_utils_configuration')
+    mocker.patch.object(Path, "exists", MagicMock(return_value=True))
+    with pytest.raises(OperationalException,
+                       match=r".* already exists. Please choose another Strategy Name\."):
+        start_new_strategy(get_args(args))
+
 
 def test_start_new_strategy_DefaultStrat(mocker, caplog):
     args = [
@@ -512,6 +528,12 @@ def test_start_new_hyperopt(mocker, caplog):
     assert "CoolNewhyperopt" in wt_mock.call_args_list[0][0][0]
     assert log_has_re("Writing hyperopt to .*", caplog)
 
+    mocker.patch('freqtrade.commands.deploy_commands.setup_utils_configuration')
+    mocker.patch.object(Path, "exists", MagicMock(return_value=True))
+    with pytest.raises(OperationalException,
+                       match=r".* already exists. Please choose another Hyperopt Name\."):
+        start_new_hyperopt(get_args(args))
+
 
 def test_start_new_hyperopt_DefaultHyperopt(mocker, caplog):
     args = [
@@ -695,6 +717,7 @@ def test_start_list_strategies(mocker, caplog, capsys):
         "list-strategies",
         "--strategy-path",
         str(Path(__file__).parent.parent / "strategy" / "strats"),
+        '--no-color',
     ]
     pargs = get_args(args)
     # pargs['config'] = None
@@ -769,6 +792,25 @@ def test_start_test_pairlist(mocker, caplog, tickers, default_conf, capsys):
     assert re.match(r"Pairs for .*", captured.out)
     assert re.match("['ETH/BTC', 'TKN/BTC', 'BLK/BTC', 'LTC/BTC', 'XRP/BTC']", captured.out)
 
+    args = [
+        'test-pairlist',
+        '-c', 'config.json.example',
+        '--one-column',
+    ]
+    start_test_pairlist(get_args(args))
+    captured = capsys.readouterr()
+    assert re.match(r"ETH/BTC\nTKN/BTC\nBLK/BTC\nLTC/BTC\nXRP/BTC\n", captured.out)
+
+    args = [
+        'test-pairlist',
+        '-c', 'config.json.example',
+        '--print-json',
+    ]
+    start_test_pairlist(get_args(args))
+    captured = capsys.readouterr()
+    assert re.match(r'Pairs for BTC: \n\["ETH/BTC","TKN/BTC","BLK/BTC","LTC/BTC","XRP/BTC"\]\n',
+                    captured.out)
+
 
 def test_hyperopt_list(mocker, capsys, caplog, hyperopt_results):
     mocker.patch(