Restore get_market_pairs from develop
This commit is contained in:
parent
f03acce84c
commit
72657758d5
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user