Implement to json

This commit is contained in:
Matthias 2019-12-02 07:00:38 +01:00
parent 150a497cb4
commit 0b03c6c786
2 changed files with 11 additions and 2 deletions

View File

@ -37,7 +37,7 @@ ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column"]
ARGS_LIST_PAIRS = ["exchange", "print_list", "list_pairs_print_json", "print_one_column",
"print_csv", "base_currencies", "quote_currencies", "list_pairs_all"]
ARGS_TEST_PAIRLIST = ["config", "quote_currencies"]
ARGS_TEST_PAIRLIST = ["config", "quote_currencies", "print_one_column", "list_pairs_print_json"]
ARGS_CREATE_USERDIR = ["user_data_dir", "reset"]

View File

@ -344,4 +344,13 @@ def start_test_pairlist(args: Dict[str, Any]) -> None:
for curr, pairlist in results.items():
print(f"Pairs for {curr}: ")
print(pairlist)
summary_str = ""
if args.get('print_list', False):
# print data as a list, with human-readable summary
print(f"{summary_str}: {', '.join(pairlist)}.")
elif args.get('print_one_column', False):
print('\n'.join(pairlist))
elif args.get('list_pairs_print_json', False):
print(rapidjson.dumps(list(pairlist), default=str))
else:
print(pairlist)