stable/freqtrade/utils.py

42 lines
1.1 KiB
Python
Raw Normal View History

2019-06-12 09:33:20 +00:00
import logging
from argparse import Namespace
from typing import Any, Dict
from freqtrade.configuration import Configuration
2019-06-16 08:39:43 +00:00
from freqtrade.exchange import available_exchanges
2019-06-12 09:33:20 +00:00
from freqtrade.state import RunMode
logger = logging.getLogger(__name__)
2019-06-16 18:37:43 +00:00
def setup_utils_configuration(args: Namespace, method: RunMode) -> Dict[str, Any]:
2019-06-12 09:33:20 +00:00
"""
2019-06-16 18:37:43 +00:00
Prepare the configuration for utils subcommands
2019-06-12 09:33:20 +00:00
:param args: Cli args from Arguments()
:return: Configuration
"""
configuration = Configuration(args, method)
config = configuration.load_config()
2019-06-16 18:37:43 +00:00
config['exchange']['dry_run'] = True
2019-06-12 09:33:20 +00:00
# Ensure we do not use Exchange credentials
config['exchange']['key'] = ''
config['exchange']['secret'] = ''
return config
def start_list_exchanges(args: Namespace) -> None:
"""
Print available exchanges
2019-06-12 09:33:20 +00:00
:param args: Cli args from Arguments()
:return: None
"""
if args.print_one_column:
2019-06-16 08:39:43 +00:00
print('\n'.join(available_exchanges()))
2019-06-12 09:33:20 +00:00
else:
print(f"Exchanges supported by ccxt and available for Freqtrade: "
2019-06-16 08:39:43 +00:00
f"{', '.join(available_exchanges())}")