Some more adjustments for new pairlist
This commit is contained in:
parent
c74d766275
commit
25cb935eee
@ -121,6 +121,7 @@ def _validate_whitelist(conf: Dict[str, Any]) -> None:
|
|||||||
if conf.get('runmode', RunMode.OTHER) in [RunMode.OTHER, RunMode.PLOT]:
|
if conf.get('runmode', RunMode.OTHER) in [RunMode.OTHER, RunMode.PLOT]:
|
||||||
return
|
return
|
||||||
|
|
||||||
if (conf.get('pairlist', {}).get('method', 'StaticPairList') == 'StaticPairList'
|
for pl in conf.get('pairlists', [{'method': 'StaticPairList'}]):
|
||||||
|
if (pl.get('method') == 'StaticPairList'
|
||||||
and not conf.get('exchange', {}).get('pair_whitelist')):
|
and not conf.get('exchange', {}).get('pair_whitelist')):
|
||||||
raise OperationalException("StaticPairList requires pair_whitelist to be set.")
|
raise OperationalException("StaticPairList requires pair_whitelist to be set.")
|
||||||
|
@ -81,6 +81,9 @@ class Configuration:
|
|||||||
if 'ask_strategy' not in config:
|
if 'ask_strategy' not in config:
|
||||||
config['ask_strategy'] = {}
|
config['ask_strategy'] = {}
|
||||||
|
|
||||||
|
if 'pairlists' not in config:
|
||||||
|
config['pairlists'] = []
|
||||||
|
|
||||||
# validate configuration before returning
|
# validate configuration before returning
|
||||||
logger.info('Validating configuration ...')
|
logger.info('Validating configuration ...')
|
||||||
validate_config_schema(config)
|
validate_config_schema(config)
|
||||||
|
@ -58,9 +58,18 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
|
|||||||
process_deprecated_setting(config, 'ask_strategy', 'ignore_roi_if_buy_signal',
|
process_deprecated_setting(config, 'ask_strategy', 'ignore_roi_if_buy_signal',
|
||||||
'experimental', 'ignore_roi_if_buy_signal')
|
'experimental', 'ignore_roi_if_buy_signal')
|
||||||
|
|
||||||
|
if config.get('pairlist', {}).get("method") == 'VolumePairList':
|
||||||
|
logger.warning(
|
||||||
|
"DEPRECATED: "
|
||||||
|
f"Using VolumePairList in pairlist is deprecated and must be moved to pairlists. "
|
||||||
|
"Please refer to the docs on configuration details")
|
||||||
|
config['pairlists'].append({'method': 'VolumePairList',
|
||||||
|
'config': config.get('pairlist', {}).get('config')
|
||||||
|
})
|
||||||
|
|
||||||
if config.get('pairlist', {}).get('config', {}).get('precision_filter'):
|
if config.get('pairlist', {}).get('config', {}).get('precision_filter'):
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"DEPRECATED: "
|
"DEPRECATED: "
|
||||||
f"Using precision_filter setting is deprecated and has been replaced by"
|
f"Using precision_filter setting is deprecated and has been replaced by"
|
||||||
"PrecisionFilter. Please refer to the docs on configuration details")
|
"PrecisionFilter. Please refer to the docs on configuration details")
|
||||||
config['pairlist'].update({'filters': {'PrecisionFilter': {}}})
|
config['pairlists'].append({'method': 'PrecisionFilter'})
|
||||||
|
@ -242,6 +242,9 @@ def default_conf(testdatadir):
|
|||||||
"HOT/BTC",
|
"HOT/BTC",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"pairlists": [
|
||||||
|
{"method": "StaticPairList"}
|
||||||
|
],
|
||||||
"telegram": {
|
"telegram": {
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
"token": "token",
|
"token": "token",
|
||||||
|
@ -1050,8 +1050,8 @@ def test_whitelist_static(default_conf, update, mocker) -> None:
|
|||||||
|
|
||||||
telegram._whitelist(update=update, context=MagicMock())
|
telegram._whitelist(update=update, context=MagicMock())
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert ('Using whitelist `StaticPairList` with 4 pairs\n`ETH/BTC, LTC/BTC, XRP/BTC, NEO/BTC`'
|
assert ("Using whitelist `['StaticPairList']` with 4 pairs\n"
|
||||||
in msg_mock.call_args_list[0][0][0])
|
"`ETH/BTC, LTC/BTC, XRP/BTC, NEO/BTC`" in msg_mock.call_args_list[0][0][0])
|
||||||
|
|
||||||
|
|
||||||
def test_whitelist_dynamic(default_conf, update, mocker) -> None:
|
def test_whitelist_dynamic(default_conf, update, mocker) -> None:
|
||||||
@ -1062,17 +1062,17 @@ def test_whitelist_dynamic(default_conf, update, mocker) -> None:
|
|||||||
_send_msg=msg_mock
|
_send_msg=msg_mock
|
||||||
)
|
)
|
||||||
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
|
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
|
||||||
default_conf['pairlist'] = {'method': 'VolumePairList',
|
default_conf['pairlists'] = [{'method': 'VolumePairList',
|
||||||
'config': {'number_assets': 4}
|
'config': {'number_assets': 4}
|
||||||
}
|
}]
|
||||||
freqtradebot = get_patched_freqtradebot(mocker, default_conf)
|
freqtradebot = get_patched_freqtradebot(mocker, default_conf)
|
||||||
|
|
||||||
telegram = Telegram(freqtradebot)
|
telegram = Telegram(freqtradebot)
|
||||||
|
|
||||||
telegram._whitelist(update=update, context=MagicMock())
|
telegram._whitelist(update=update, context=MagicMock())
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert ('Using whitelist `VolumePairList` with 4 pairs\n`ETH/BTC, LTC/BTC, XRP/BTC, NEO/BTC`'
|
assert ("Using whitelist `['VolumePairList']` with 4 pairs\n"
|
||||||
in msg_mock.call_args_list[0][0][0])
|
"`ETH/BTC, LTC/BTC, XRP/BTC, NEO/BTC`" in msg_mock.call_args_list[0][0][0])
|
||||||
|
|
||||||
|
|
||||||
def test_blacklist_static(default_conf, update, mocker) -> None:
|
def test_blacklist_static(default_conf, update, mocker) -> None:
|
||||||
|
@ -743,9 +743,9 @@ def test_validate_whitelist(default_conf):
|
|||||||
|
|
||||||
conf = deepcopy(default_conf)
|
conf = deepcopy(default_conf)
|
||||||
|
|
||||||
conf.update({"pairlist": {
|
conf.update({"pairlists": [{
|
||||||
"method": "VolumePairList",
|
"method": "VolumePairList",
|
||||||
}})
|
}]})
|
||||||
# Dynamic whitelist should not care about pair_whitelist
|
# Dynamic whitelist should not care about pair_whitelist
|
||||||
validate_config_consistency(conf)
|
validate_config_consistency(conf)
|
||||||
del conf['exchange']['pair_whitelist']
|
del conf['exchange']['pair_whitelist']
|
||||||
@ -963,14 +963,16 @@ def test_process_temporary_deprecated_settings(mocker, default_conf, setting, ca
|
|||||||
assert default_conf[setting[0]][setting[1]] == setting[5]
|
assert default_conf[setting[0]][setting[1]] == setting[5]
|
||||||
|
|
||||||
|
|
||||||
def test_process_deprecated_setting_precision_filter(mocker, default_conf, caplog):
|
def test_process_deprecated_setting_pairlists(mocker, default_conf, caplog):
|
||||||
patched_configuration_load_config_file(mocker, default_conf)
|
patched_configuration_load_config_file(mocker, default_conf)
|
||||||
default_conf.update({'pairlist': {
|
default_conf.update({'pairlist': {
|
||||||
|
'method': 'VolumePairList',
|
||||||
'config': {'precision_filter': True}
|
'config': {'precision_filter': True}
|
||||||
}})
|
}})
|
||||||
|
|
||||||
process_temporary_deprecated_settings(default_conf)
|
process_temporary_deprecated_settings(default_conf)
|
||||||
assert log_has_re(r'DEPRECATED.*precision_filter.*', caplog)
|
assert log_has_re(r'DEPRECATED.*precision_filter.*', caplog)
|
||||||
|
assert log_has_re(r'DEPRECATED.*in pairlist is deprecated and must be moved*', caplog)
|
||||||
|
|
||||||
|
|
||||||
def test_check_conflicting_settings(mocker, default_conf, caplog):
|
def test_check_conflicting_settings(mocker, default_conf, caplog):
|
||||||
|
Loading…
Reference in New Issue
Block a user