diff --git a/freqtrade/commands/data_commands.py b/freqtrade/commands/data_commands.py index 5dc5fe7ea..f55a857c4 100644 --- a/freqtrade/commands/data_commands.py +++ b/freqtrade/commands/data_commands.py @@ -161,10 +161,16 @@ def start_list_data(args: Dict[str, Any]) -> None: print(f"Found {len(paircombs)} pair / timeframe combinations.") groupedpair = defaultdict(list) - for pair, timeframe in sorted(paircombs, key=lambda x: (x[0], timeframe_to_minutes(x[1]))): - groupedpair[pair].append(timeframe) + for pair, timeframe, candle_type in sorted( + paircombs, + key=lambda x: (x[0], timeframe_to_minutes(x[1]), x[2]) + ): + groupedpair[(pair, candle_type)].append(timeframe) if groupedpair: - print(tabulate([(pair, ', '.join(timeframes)) for pair, timeframes in groupedpair.items()], - headers=("Pair", "Timeframe"), - tablefmt='psql', stralign='right')) + print(tabulate([ + (pair, ', '.join(timeframes), candle_type) + for (pair, candle_type), timeframes in groupedpair.items() + ], + headers=("Pair", "Timeframe", "Type"), + tablefmt='psql', stralign='right')) diff --git a/freqtrade/constants.py b/freqtrade/constants.py index e41ecd4f8..52c21ce58 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -467,7 +467,7 @@ CANCEL_REASON = { } # List of pairs with their timeframes -PairWithTimeframe = Tuple[str, str] +PairWithTimeframe = Tuple[str, str, str] ListPairsWithTimeframes = List[PairWithTimeframe] # Type for trades list diff --git a/freqtrade/data/history/hdf5datahandler.py b/freqtrade/data/history/hdf5datahandler.py index 6a66118c4..a59d7255d 100644 --- a/freqtrade/data/history/hdf5datahandler.py +++ b/freqtrade/data/history/hdf5datahandler.py @@ -28,9 +28,13 @@ class HDF5DataHandler(IDataHandler): :param datadir: Directory to search for ohlcv files :return: List of Tuples of (pair, timeframe) """ - _tmp = [re.search(r'^([a-zA-Z_]+)\-(\d+\S+)(?=.h5)', p.name) - for p in datadir.glob("*.h5")] - return [(match[1].replace('_', '/'), match[2]) for match in _tmp + _tmp = [ + re.search( + r'^([a-zA-Z_]+)\-(\d+\S)\-?([a-zA-Z_]*)?(?=.h5)', + p.name + ) for p in datadir.glob("*.h5") + ] + return [(match[1].replace('_', '/'), match[2], match[3]) for match in _tmp if match and len(match.groups()) > 1] @classmethod diff --git a/freqtrade/data/history/jsondatahandler.py b/freqtrade/data/history/jsondatahandler.py index ddbc626bc..57b21f894 100644 --- a/freqtrade/data/history/jsondatahandler.py +++ b/freqtrade/data/history/jsondatahandler.py @@ -29,9 +29,12 @@ class JsonDataHandler(IDataHandler): :param datadir: Directory to search for ohlcv files :return: List of Tuples of (pair, timeframe) """ - _tmp = [re.search(r'^([a-zA-Z_]+)\-(\d+\S+)(?=.json)', p.name) - for p in datadir.glob(f"*.{cls._get_file_extension()}")] - return [(match[1].replace('_', '/'), match[2]) for match in _tmp + _tmp = [ + re.search( + r'^([a-zA-Z_]+)\-(\d+\S)\-?([a-zA-Z_]*)?(?=.json)', + p.name + ) for p in datadir.glob(f"*.{cls._get_file_extension()}")] + return [(match[1].replace('_', '/'), match[2], match[3]) for match in _tmp if match and len(match.groups()) > 1] @classmethod diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index 55fc4463d..72d2c6de4 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -1326,9 +1326,10 @@ def test_start_list_data(testdatadir, capsys): pargs['config'] = None start_list_data(pargs) captured = capsys.readouterr() - assert "Found 17 pair / timeframe combinations." in captured.out - assert "\n| Pair | Timeframe |\n" in captured.out - assert "\n| UNITTEST/BTC | 1m, 5m, 8m, 30m |\n" in captured.out + assert "Found 19 pair / timeframe combinations." in captured.out + assert "\n| Pair | Timeframe | Type |\n" in captured.out + assert "\n| UNITTEST/BTC | 1m, 5m, 8m, 30m | |\n" in captured.out + assert "\n| UNITTEST/USDT | 1h | mark |\n" in captured.out args = [ "list-data", @@ -1343,9 +1344,9 @@ def test_start_list_data(testdatadir, capsys): start_list_data(pargs) captured = capsys.readouterr() assert "Found 2 pair / timeframe combinations." in captured.out - assert "\n| Pair | Timeframe |\n" in captured.out + assert "\n| Pair | Timeframe | Type |\n" in captured.out assert "UNITTEST/BTC" not in captured.out - assert "\n| XRP/ETH | 1m, 5m |\n" in captured.out + assert "\n| XRP/ETH | 1m, 5m | |\n" in captured.out @pytest.mark.usefixtures("init_persistence")