From 504efbd6d4c093bd8aa09eccdc43901a05f30255 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 27 Nov 2021 16:36:59 +0100 Subject: [PATCH] Add futures argument to download-data command --- freqtrade/commands/arguments.py | 2 +- freqtrade/commands/data_commands.py | 2 ++ tests/commands/test_commands.py | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/freqtrade/commands/arguments.py b/freqtrade/commands/arguments.py index 025fee66c..3ebad54dc 100644 --- a/freqtrade/commands/arguments.py +++ b/freqtrade/commands/arguments.py @@ -69,7 +69,7 @@ ARGS_LIST_DATA = ["exchange", "dataformat_ohlcv", "pairs"] ARGS_DOWNLOAD_DATA = ["pairs", "pairs_file", "days", "new_pairs_days", "include_inactive", "timerange", "download_trades", "exchange", "timeframes", - "erase", "dataformat_ohlcv", "dataformat_trades"] + "erase", "dataformat_ohlcv", "dataformat_trades", "trading_mode"] ARGS_PLOT_DATAFRAME = ["pairs", "indicators1", "indicators2", "plot_limit", "db_url", "trade_source", "export", "exportfilename", diff --git a/freqtrade/commands/data_commands.py b/freqtrade/commands/data_commands.py index f55a857c4..2737e1013 100644 --- a/freqtrade/commands/data_commands.py +++ b/freqtrade/commands/data_commands.py @@ -64,6 +64,8 @@ def start_download_data(args: Dict[str, Any]) -> None: try: if config.get('download_trades'): + if config.get('trading_mode') == 'futures': + raise OperationalException("Trade download not supported for futures.") pairs_not_available = refresh_backtest_trades_data( exchange, pairs=expanded_pairs, datadir=config['datadir'], timerange=timerange, new_pairs_days=config['new_pairs_days'], diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index 384254b74..1981e9413 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -814,6 +814,18 @@ def test_download_data_trades(mocker, caplog): assert dl_mock.call_args[1]['timerange'].starttype == "date" assert dl_mock.call_count == 1 assert convert_mock.call_count == 1 + args = [ + "download-data", + "--exchange", "kraken", + "--pairs", "ETH/BTC", "XRP/BTC", + "--days", "20", + "--trading-mode", "futures", + "--dl-trades" + ] + with pytest.raises(OperationalException, + match="Trade download not supported for futures."): + + start_download_data(get_args(args)) def test_start_convert_trades(mocker, caplog):