diff --git a/config_kraken.json.example b/config_kraken.json.example index 51aa9a8e9..5a36941d8 100644 --- a/config_kraken.json.example +++ b/config_kraken.json.example @@ -70,5 +70,6 @@ "forcebuy_enable": false, "internals": { "process_throttle_secs": 5 - } + }, + "download_trades": true } diff --git a/freqtrade/configuration/arguments.py b/freqtrade/configuration/arguments.py index 76a2b1cc9..e63249577 100644 --- a/freqtrade/configuration/arguments.py +++ b/freqtrade/configuration/arguments.py @@ -35,7 +35,8 @@ ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column"] ARGS_CREATE_USERDIR = ["user_data_dir"] -ARGS_DOWNLOAD_DATA = ["pairs", "pairs_file", "days", "exchange", "timeframes", "erase"] +ARGS_DOWNLOAD_DATA = ["pairs", "pairs_file", "days", "download_trades", "exchange", + "timeframes", "erase"] ARGS_PLOT_DATAFRAME = ["pairs", "indicators1", "indicators2", "plot_limit", "db_url", "trade_source", "export", "exportfilename", "timerange", "ticker_interval"] diff --git a/freqtrade/configuration/cli_options.py b/freqtrade/configuration/cli_options.py index 7e6a956ce..9868ab874 100644 --- a/freqtrade/configuration/cli_options.py +++ b/freqtrade/configuration/cli_options.py @@ -273,6 +273,11 @@ AVAILABLE_CLI_OPTIONS = { type=check_int_positive, metavar='INT', ), + "download_trades": Arg( + '--dl-trades', + help='Download trades instead of OHLCV data.', + action='store_true', + ), "exchange": Arg( '--exchange', help=f'Exchange name (default: `{constants.DEFAULT_EXCHANGE}`). ' diff --git a/freqtrade/configuration/configuration.py b/freqtrade/configuration/configuration.py index 665999efb..ec47f7855 100644 --- a/freqtrade/configuration/configuration.py +++ b/freqtrade/configuration/configuration.py @@ -312,6 +312,8 @@ class Configuration: self._args_to_config(config, argname='days', logstring='Detected --days: {}') + self._args_to_config(config, argname='download_trades', + logstring='Detected --dl-trades: {}') def _process_runmode(self, config: Dict[str, Any]) -> None: diff --git a/freqtrade/utils.py b/freqtrade/utils.py index adcb3f6e0..48734883c 100644 --- a/freqtrade/utils.py +++ b/freqtrade/utils.py @@ -90,12 +90,7 @@ def start_download_data(args: Dict[str, Any]) -> None: # Init exchange exchange = ExchangeResolver(config['exchange']['name'], config).exchange - # TODO Add correct switch here! - if 1 == 2: - pairs_not_available = refresh_backtest_ohlcv_data( - exchange, pairs=config["pairs"], timeframes=config["timeframes"], - dl_path=Path(config['datadir']), timerange=timerange, erase=config.get("erase")) - else: + if config.get('download_trades'): pairs_not_available = refresh_backtest_trades_data( exchange, pairs=config["pairs"], datadir=Path(config['datadir']), timerange=timerange, erase=config.get("erase")) @@ -104,6 +99,10 @@ def start_download_data(args: Dict[str, Any]) -> None: convert_trades_to_ohlcv( exchange, pairs=config["pairs"], timeframes=config["timeframes"], datadir=Path(config['datadir']), timerange=timerange, erase=config.get("erase")) + else: + pairs_not_available = refresh_backtest_ohlcv_data( + exchange, pairs=config["pairs"], timeframes=config["timeframes"], + dl_path=Path(config['datadir']), timerange=timerange, erase=config.get("erase")) except KeyboardInterrupt: sys.exit("SIGINT received, aborting ...")