Merge pull request #1750 from hroff-1902/ccxt-to-exchange-only

minor: limit usage of ccxt to freqtrade/exchange only
This commit is contained in:
Matthias
2019-04-19 06:51:08 +02:00
committed by GitHub
13 changed files with 66 additions and 44 deletions

View File

@@ -9,14 +9,15 @@ from argparse import Namespace
from logging.handlers import RotatingFileHandler
from typing import Any, Dict, List, Optional
import ccxt
from jsonschema import Draft4Validator, validate
from jsonschema.exceptions import ValidationError, best_match
from freqtrade import OperationalException, constants
from freqtrade.exchange import is_exchange_supported, supported_exchanges
from freqtrade.misc import deep_merge_dicts
from freqtrade.state import RunMode
logger = logging.getLogger(__name__)
@@ -384,10 +385,11 @@ class Configuration(object):
:return: True or raised an exception if the exchange if not supported
"""
exchange = config.get('exchange', {}).get('name').lower()
if exchange not in ccxt.exchanges:
if not is_exchange_supported(exchange):
exception_msg = f'Exchange "{exchange}" not supported.\n' \
f'The following exchanges are supported: {", ".join(ccxt.exchanges)}'
f'The following exchanges are supported: ' \
f'{", ".join(supported_exchanges())}'
logger.critical(exception_msg)
raise OperationalException(