From 5298ea2c33ee85e13aafc39283a3db9a8978978b Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 8 Feb 2020 10:12:43 +0100 Subject: [PATCH] Copy 'pairs' to pair_whitelist to validate the correct pairs against the exchange --- freqtrade/commands/data_commands.py | 4 ++++ tests/commands/test_commands.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/freqtrade/commands/data_commands.py b/freqtrade/commands/data_commands.py index ddc2ca25b..793a01323 100644 --- a/freqtrade/commands/data_commands.py +++ b/freqtrade/commands/data_commands.py @@ -31,6 +31,10 @@ def start_download_data(args: Dict[str, Any]) -> None: "Downloading data requires a list of pairs. " "Please check the documentation on how to configure this.") + # Syncronize Pair whitelist and pairs - since 'pair_whitelist' is checked + # against the exchange - but not 'pairs' + config['exchange']['pair_whitelist'] = config['pairs'] + logger.info(f'About to download pairs: {config["pairs"]}, ' f'intervals: {config["timeframes"]} to {config["datadir"]}') diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index c59799190..15fb11021 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -563,6 +563,7 @@ def test_download_data_no_markets(mocker, caplog): mocker.patch( 'freqtrade.exchange.Exchange.markets', PropertyMock(return_value={}) ) + validate_mock = mocker.patch('freqtrade.exchange.Exchange.validate_pairs') args = [ "download-data", "--exchange", "binance", @@ -572,6 +573,7 @@ def test_download_data_no_markets(mocker, caplog): start_download_data(get_args(args)) assert dl_mock.call_args[1]['timerange'].starttype == "date" assert log_has("Pairs [ETH/BTC,XRP/BTC] not available on exchange Binance.", caplog) + assert validate_mock.call_args_list[0][0][0] == ['ETH/BTC', 'XRP/BTC'] def test_download_data_no_exchange(mocker, caplog):