Enhance formatting, Add pair filter
This commit is contained in:
parent
b035d9e267
commit
62c55b1863
@ -166,6 +166,7 @@ You can get a list of downloaded data using the `list-data` subcommand.
|
|||||||
usage: freqtrade list-data [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
|
usage: freqtrade list-data [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
|
||||||
[--userdir PATH] [--exchange EXCHANGE]
|
[--userdir PATH] [--exchange EXCHANGE]
|
||||||
[--data-format-ohlcv {json,jsongz}]
|
[--data-format-ohlcv {json,jsongz}]
|
||||||
|
[-p PAIRS [PAIRS ...]]
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
@ -174,6 +175,9 @@ optional arguments:
|
|||||||
--data-format-ohlcv {json,jsongz}
|
--data-format-ohlcv {json,jsongz}
|
||||||
Storage format for downloaded candle (OHLCV) data.
|
Storage format for downloaded candle (OHLCV) data.
|
||||||
(default: `json`).
|
(default: `json`).
|
||||||
|
-p PAIRS [PAIRS ...], --pairs PAIRS [PAIRS ...]
|
||||||
|
Show profits for only these pairs. Pairs are space-
|
||||||
|
separated.
|
||||||
|
|
||||||
Common arguments:
|
Common arguments:
|
||||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||||
@ -190,7 +194,6 @@ Common arguments:
|
|||||||
Path to directory with historical backtesting data.
|
Path to directory with historical backtesting data.
|
||||||
--userdir PATH, --user-data-dir PATH
|
--userdir PATH, --user-data-dir PATH
|
||||||
Path to userdata directory.
|
Path to userdata directory.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Example list-data
|
#### Example list-data
|
||||||
|
@ -54,7 +54,7 @@ ARGS_BUILD_HYPEROPT = ["user_data_dir", "hyperopt", "template"]
|
|||||||
ARGS_CONVERT_DATA = ["pairs", "format_from", "format_to", "erase"]
|
ARGS_CONVERT_DATA = ["pairs", "format_from", "format_to", "erase"]
|
||||||
ARGS_CONVERT_DATA_OHLCV = ARGS_CONVERT_DATA + ["timeframes"]
|
ARGS_CONVERT_DATA_OHLCV = ARGS_CONVERT_DATA + ["timeframes"]
|
||||||
|
|
||||||
ARGS_LIST_DATA = ["exchange", "dataformat_ohlcv"]
|
ARGS_LIST_DATA = ["exchange", "dataformat_ohlcv", "pairs"]
|
||||||
|
|
||||||
ARGS_DOWNLOAD_DATA = ["pairs", "pairs_file", "days", "download_trades", "exchange",
|
ARGS_DOWNLOAD_DATA = ["pairs", "pairs_file", "days", "download_trades", "exchange",
|
||||||
"timeframes", "erase", "dataformat_ohlcv", "dataformat_trades"]
|
"timeframes", "erase", "dataformat_ohlcv", "dataformat_trades"]
|
||||||
|
@ -105,10 +105,14 @@ def start_list_data(args: Dict[str, Any]) -> None:
|
|||||||
|
|
||||||
paircombs = dhc.ohlcv_get_available_data(config['datadir'])
|
paircombs = dhc.ohlcv_get_available_data(config['datadir'])
|
||||||
|
|
||||||
|
if args['pairs']:
|
||||||
|
paircombs = [comb for comb in paircombs if comb[0] in args['pairs']]
|
||||||
|
|
||||||
print(f"Found {len(paircombs)} pair / timeframe combinations.")
|
print(f"Found {len(paircombs)} pair / timeframe combinations.")
|
||||||
groupedpair = defaultdict(list)
|
groupedpair = defaultdict(list)
|
||||||
for pair, timeframe in sorted(paircombs, key=lambda x: (x[0], timeframe_to_minutes(x[1]))):
|
for pair, timeframe in sorted(paircombs, key=lambda x: (x[0], timeframe_to_minutes(x[1]))):
|
||||||
groupedpair[pair].append(timeframe)
|
groupedpair[pair].append(timeframe)
|
||||||
|
|
||||||
print(tabulate([(pair, ', '.join(timeframes)) for pair, timeframes in groupedpair.items()],
|
print(tabulate([(pair, ', '.join(timeframes)) for pair, timeframes in groupedpair.items()],
|
||||||
headers=("pairs", "timeframe")))
|
headers=("Pair", "Timeframe"),
|
||||||
|
tablefmt='psql', stralign='right'))
|
||||||
|
@ -1056,8 +1056,25 @@ def test_start_list_data(testdatadir, capsys):
|
|||||||
start_list_data(pargs)
|
start_list_data(pargs)
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert "Found 16 pair / timeframe combinations." in captured.out
|
assert "Found 16 pair / timeframe combinations." in captured.out
|
||||||
assert "\npairs timeframe\n" in captured.out
|
assert "\n| Pair | Timeframe |\n" in captured.out
|
||||||
assert "\nUNITTEST/BTC 1m, 5m, 8m, 30m\n" in captured.out
|
assert "\n| UNITTEST/BTC | 1m, 5m, 8m, 30m |\n" in captured.out
|
||||||
|
|
||||||
|
args = [
|
||||||
|
"list-data",
|
||||||
|
"--data-format-ohlcv",
|
||||||
|
"json",
|
||||||
|
"--pairs", "XRP/ETH",
|
||||||
|
"--datadir",
|
||||||
|
str(testdatadir),
|
||||||
|
]
|
||||||
|
pargs = get_args(args)
|
||||||
|
pargs['config'] = None
|
||||||
|
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 "UNITTEST/BTC" not in captured.out
|
||||||
|
assert "\n| XRP/ETH | 1m, 5m |\n" in captured.out
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("init_persistence")
|
@pytest.mark.usefixtures("init_persistence")
|
||||||
|
Loading…
Reference in New Issue
Block a user