From 72657758d550f780342cee1b017d09d67bc73edc Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 19 Apr 2019 06:43:12 +0200 Subject: [PATCH] Restore get_market_pairs from develop --- scripts/get_market_pairs.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/scripts/get_market_pairs.py b/scripts/get_market_pairs.py index 00639c50b..cd38bf2fa 100644 --- a/scripts/get_market_pairs.py +++ b/scripts/get_market_pairs.py @@ -1,7 +1,10 @@ +""" +This script was adapted from ccxt here: +https://github.com/ccxt/ccxt/blob/master/examples/py/arbitrage-pairs.py +""" import os import sys - -from freqtrade.exchange import is_exchange_supported, supported_exchanges +import traceback root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(root + '/python') @@ -46,15 +49,22 @@ def dump(*args): def print_supported_exchanges(): - dump('Supported exchanges:', green(', '.join(supported_exchanges()))) + dump('Supported exchanges:', green(', '.join(ccxt.exchanges))) try: + if len(sys.argv) < 2: + dump("Usage: python " + sys.argv[0], green('id')) + print_supported_exchanges() + sys.exit(1) + id = sys.argv[1] # get exchange id from command line arguments # check if the exchange is supported by ccxt - if is_exchange_supported(id): + exchange_found = id in ccxt.exchanges + + if exchange_found: dump('Instantiating', green(id), 'exchange') # instantiate the exchange by id @@ -79,11 +89,15 @@ try: for (k, v) in tuples: dump('{:<15} {:<15} {:<15} {:<15}'.format(v['id'], v['symbol'], v['base'], v['quote'])) + else: + dump('Exchange ' + red(id) + ' not found') print_supported_exchanges() except Exception as e: dump('[' + type(e).__name__ + ']', str(e)) + dump(traceback.format_exc()) dump("Usage: python " + sys.argv[0], green('id')) print_supported_exchanges() + sys.exit(1)