Add --print-json and -1/--one-column options
This commit is contained in:
parent
ad89d19955
commit
89e0c76a3f
@ -34,7 +34,8 @@ ARGS_LIST_EXCHANGES = ["print_one_column", "list_exchanges_all"]
|
|||||||
|
|
||||||
ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column"]
|
ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column"]
|
||||||
|
|
||||||
ARGS_LIST_PAIRS = ["exchange", "print_list", "base_currency", "quote_currency", "active_only"]
|
ARGS_LIST_PAIRS = ["exchange", "print_list", "list_pairs_print_json", "print_one_column",
|
||||||
|
"base_currency", "quote_currency", "active_only"]
|
||||||
|
|
||||||
ARGS_CREATE_USERDIR = ["user_data_dir"]
|
ARGS_CREATE_USERDIR = ["user_data_dir"]
|
||||||
|
|
||||||
|
@ -262,6 +262,12 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
'printed in the tabular format.',
|
'printed in the tabular format.',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
),
|
),
|
||||||
|
"list_pairs_print_json": Arg(
|
||||||
|
'--print-json',
|
||||||
|
help='Print list of pairs or market symbols in JSON format.',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
),
|
||||||
"quote_currency": Arg(
|
"quote_currency": Arg(
|
||||||
'--quote-currency',
|
'--quote-currency',
|
||||||
help='Select quote currency.',
|
help='Select quote currency.',
|
||||||
|
@ -4,6 +4,7 @@ from pathlib import Path
|
|||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
import arrow
|
import arrow
|
||||||
|
import rapidjson
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
|
|
||||||
from freqtrade import OperationalException
|
from freqtrade import OperationalException
|
||||||
@ -156,6 +157,10 @@ def start_list_pairs(args: Dict[str, Any], pairs_only: bool = False) -> None:
|
|||||||
(" and" if base_currency and quote_currency else "") +
|
(" and" if base_currency and quote_currency else "") +
|
||||||
(f" with {quote_currency} as quote currency" if quote_currency else "") +
|
(f" with {quote_currency} as quote currency" if quote_currency else "") +
|
||||||
(f": {', '.join(sorted(pairs.keys()))}" if len(pairs) else "") + ".")
|
(f": {', '.join(sorted(pairs.keys()))}" if len(pairs) else "") + ".")
|
||||||
|
elif args.get('print_one_column', False):
|
||||||
|
print('\n'.join(sorted(pairs.keys())))
|
||||||
|
elif args.get('list_pairs_print_json', False):
|
||||||
|
print(rapidjson.dumps(sorted(pairs.keys()), default=str))
|
||||||
else:
|
else:
|
||||||
# print data as a table
|
# print data as a table
|
||||||
headers = ['Id', 'Symbol', 'Base', 'Quote', 'Active']
|
headers = ['Id', 'Symbol', 'Base', 'Quote', 'Active']
|
||||||
|
Loading…
Reference in New Issue
Block a user