From 837d4d82b4ba326815d948f0a0b3af64cd05d634 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Thu, 17 Oct 2019 03:06:51 +0300 Subject: [PATCH] Sort tabular and csv data by symbol as well --- freqtrade/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/freqtrade/utils.py b/freqtrade/utils.py index 1e9aca647..703cff35d 100644 --- a/freqtrade/utils.py +++ b/freqtrade/utils.py @@ -1,5 +1,6 @@ import logging import sys +from collections import OrderedDict from pathlib import Path from typing import Any, Dict, List @@ -147,6 +148,8 @@ def start_list_pairs(args: Dict[str, Any], pairs_only: bool = False) -> None: # quote_currencies=quote_currencies, pairs_only=pairs_only, active_only=active_only) + # Sort the pairs/markets by symbol + pairs = OrderedDict(sorted(pairs.items())) except Exception as e: raise OperationalException(f"Cannot get markets. Reason: {e}") from e @@ -180,13 +183,13 @@ def start_list_pairs(args: Dict[str, Any], pairs_only: bool = False) -> None: # if args.get('print_list', False): # print data as a list, with human-readable summary print(summary_str + - (f": {', '.join(sorted(pairs.keys()))}" if len(pairs) else "") + ".") + (f": {', '.join(pairs.keys())}" if len(pairs) else "") + ".") elif args.get('print_one_column', False): if len(pairs): - print('\n'.join(sorted(pairs.keys()))) + print('\n'.join(pairs.keys())) elif args.get('list_pairs_print_json', False): if len(pairs): - print(rapidjson.dumps(sorted(pairs.keys()), default=str)) + print(rapidjson.dumps(pairs.keys(), default=str)) elif args.get('print_csv', False): if len(pairs): writer = csv.DictWriter(sys.stdout, fieldnames=headers)