From 5ff405b0b0e870b176cf027df68499fbb50f793c Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Mon, 4 Jun 2018 13:31:52 +0300 Subject: [PATCH 1/2] allow defining of timeframes to download --- docs/backtesting.md | 1 + freqtrade/arguments.py | 11 +++++++++++ scripts/download_backtest_data.py | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/backtesting.md b/docs/backtesting.md index ab47923c6..8364d77e4 100644 --- a/docs/backtesting.md +++ b/docs/backtesting.md @@ -117,6 +117,7 @@ This will download ticker data for all the currency pairs you defined in `pairs. - To change the exchange used to download the tickers, use `--exchange`. Default is `bittrex`. - To use `pairs.json` from some other folder, use `--pairs-file some_other_dir/pairs.json`. - To download ticker data for only 10 days, use `--days 10`. +- Use `--timeframes` to specify which tickers to download. Default is `--timeframes 1m 5m` which will download 1-minute and 5-minute tickers. For help about backtesting usage, please refer to diff --git a/freqtrade/arguments.py b/freqtrade/arguments.py index 9e88d08ca..ff9c8da2c 100644 --- a/freqtrade/arguments.py +++ b/freqtrade/arguments.py @@ -312,3 +312,14 @@ class Arguments(object): dest='exchange', type=str, default='bittrex') + + self.parser.add_argument( + '-t', '--timeframes', + help='Specify which tickers to download. Space separated list. \ + Default: %(default)s', + choices=['5m', '15m', '30m', '1h', '2h', '4h', + '6h', '8h', '12h', '1d', '3d', '1w', '1M'], + default=['1m', '5m'], + nargs='+', + dest='timeframes', + ) diff --git a/scripts/download_backtest_data.py b/scripts/download_backtest_data.py index 18a543c4e..6185edaf7 100755 --- a/scripts/download_backtest_data.py +++ b/scripts/download_backtest_data.py @@ -14,7 +14,7 @@ arguments = arguments.Arguments(sys.argv[1:], 'download utility') arguments.testdata_dl_options() args = arguments.parse_args() -TICKER_INTERVALS = ['1m', '5m'] +timeframes = args.timeframes dl_path = os.path.join(DEFAULT_DL_PATH, args.exchange) if args.export: @@ -44,7 +44,7 @@ exchange._API = exchange.init_ccxt({'key': '', for pair in PAIRS: - for tick_interval in TICKER_INTERVALS: + for tick_interval in timeframes: print(f'downloading pair {pair}, interval {tick_interval}') data = exchange.get_ticker_history(pair, tick_interval, since_ms=since_time) From 0f3dc821f21b2d37b8ce2c7e41713106b2125f0a Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Mon, 4 Jun 2018 15:03:42 +0300 Subject: [PATCH 2/2] add missing timeframes to allowed values --- freqtrade/arguments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/arguments.py b/freqtrade/arguments.py index ff9c8da2c..e63e74419 100644 --- a/freqtrade/arguments.py +++ b/freqtrade/arguments.py @@ -317,7 +317,7 @@ class Arguments(object): '-t', '--timeframes', help='Specify which tickers to download. Space separated list. \ Default: %(default)s', - choices=['5m', '15m', '30m', '1h', '2h', '4h', + choices=['1m', '3m', '5m', '15m', '30m', '1h', '2h', '4h', '6h', '8h', '12h', '1d', '3d', '1w', '1M'], default=['1m', '5m'], nargs='+',