Don't require pair_whitelist for dynamicPairlist usecases

This commit is contained in:
Matthias
2019-10-25 07:07:01 +02:00
parent b3e028e853
commit 45b83cc544
4 changed files with 43 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ from jsonschema import Draft4Validator, validators
from jsonschema.exceptions import ValidationError, best_match
from freqtrade import constants, OperationalException
from freqtrade.state import RunMode
logger = logging.getLogger(__name__)
@@ -64,6 +64,7 @@ def validate_config_consistency(conf: Dict[str, Any]) -> None:
# validating trailing stoploss
_validate_trailing_stoploss(conf)
_validate_edge(conf)
_validate_whitelist(conf)
def _validate_trailing_stoploss(conf: Dict[str, Any]) -> None:
@@ -111,3 +112,15 @@ def _validate_edge(conf: Dict[str, Any]) -> None:
"Edge and VolumePairList are incompatible, "
"Edge will override whatever pairs VolumePairlist selects."
)
def _validate_whitelist(conf: Dict[str, Any]) -> None:
"""
Dynamic whitelist does not require pair_whitelist to be set - however StaticWhitelist does.
"""
if conf.get('runmode', RunMode.OTHER) in [RunMode.OTHER, RunMode.PLOT]:
return
if (conf.get('pairlist', {}).get('method', 'StaticPairList') == 'StaticPairList'
and not conf.get('exchange', {}).get('pair_whitelist')):
raise OperationalException("StaticPairList requires pair_whitelist to be set.")

View File

@@ -179,6 +179,9 @@ class Configuration:
config['exchange']['name'] = self.args["exchange"]
logger.info(f"Using exchange {config['exchange']['name']}")
if 'pair_whitelist' not in config['exchange']:
config['exchange']['pair_whitelist'] = []
if 'user_data_dir' in self.args and self.args["user_data_dir"]:
config.update({'user_data_dir': self.args["user_data_dir"]})
elif 'user_data_dir' not in config:

View File

@@ -235,7 +235,7 @@ CONF_SCHEMA = {
'ccxt_config': {'type': 'object'},
'ccxt_async_config': {'type': 'object'}
},
'required': ['name', 'pair_whitelist']
'required': ['name']
},
'edge': {
'type': 'object',