Merge pull request #1755 from hroff-1902/scripts-get_market_pairs
Minor: impoved argument and exception handling in scripts
This commit is contained in:
commit
ed5e76adac
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
"""This script generate json data"""
|
This script generates json data
|
||||||
|
"""
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -35,7 +36,7 @@ if args.config:
|
|||||||
config: Dict[str, Any] = {}
|
config: Dict[str, Any] = {}
|
||||||
# Now expecting a list of config filenames here, not a string
|
# Now expecting a list of config filenames here, not a string
|
||||||
for path in args.config:
|
for path in args.config:
|
||||||
print('Using config: %s ...', path)
|
print(f"Using config: {path}...")
|
||||||
# Merge config options, overwriting old values
|
# Merge config options, overwriting old values
|
||||||
config = deep_merge_dicts(configuration._load_config_file(path), config)
|
config = deep_merge_dicts(configuration._load_config_file(path), config)
|
||||||
|
|
||||||
@ -44,7 +45,8 @@ if args.config:
|
|||||||
config['exchange']['key'] = ''
|
config['exchange']['key'] = ''
|
||||||
config['exchange']['secret'] = ''
|
config['exchange']['secret'] = ''
|
||||||
else:
|
else:
|
||||||
config = {'stake_currency': '',
|
config = {
|
||||||
|
'stake_currency': '',
|
||||||
'dry_run': True,
|
'dry_run': True,
|
||||||
'exchange': {
|
'exchange': {
|
||||||
'name': args.exchange,
|
'name': args.exchange,
|
||||||
@ -52,7 +54,7 @@ else:
|
|||||||
'secret': '',
|
'secret': '',
|
||||||
'pair_whitelist': [],
|
'pair_whitelist': [],
|
||||||
'ccxt_async_config': {
|
'ccxt_async_config': {
|
||||||
"enableRateLimit": False
|
'enableRateLimit': False
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ https://github.com/ccxt/ccxt/blob/master/examples/py/arbitrage-pairs.py
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
sys.path.append(root + '/python')
|
sys.path.append(root + '/python')
|
||||||
@ -53,6 +54,11 @@ def print_supported_exchanges():
|
|||||||
|
|
||||||
try:
|
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
|
id = sys.argv[1] # get exchange id from command line arguments
|
||||||
|
|
||||||
# check if the exchange is supported by ccxt
|
# check if the exchange is supported by ccxt
|
||||||
@ -91,5 +97,7 @@ try:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
dump('[' + type(e).__name__ + ']', str(e))
|
dump('[' + type(e).__name__ + ']', str(e))
|
||||||
|
dump(traceback.format_exc())
|
||||||
dump("Usage: python " + sys.argv[0], green('id'))
|
dump("Usage: python " + sys.argv[0], green('id'))
|
||||||
print_supported_exchanges()
|
print_supported_exchanges()
|
||||||
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user