2019-10-08 23:37:29 +00:00
|
|
|
"""
|
2019-10-09 00:12:30 +00:00
|
|
|
Functions to handle deprecated settings
|
2019-10-08 23:37:29 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
import logging
|
|
|
|
from typing import Any, Dict
|
|
|
|
|
2019-12-30 14:02:17 +00:00
|
|
|
from freqtrade.exceptions import OperationalException
|
2019-10-08 23:37:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def check_conflicting_settings(config: Dict[str, Any],
|
|
|
|
section1: str, name1: str,
|
2020-02-02 04:00:40 +00:00
|
|
|
section2: str, name2: str) -> None:
|
2019-10-08 23:37:29 +00:00
|
|
|
section1_config = config.get(section1, {})
|
|
|
|
section2_config = config.get(section2, {})
|
|
|
|
if name1 in section1_config and name2 in section2_config:
|
|
|
|
raise OperationalException(
|
|
|
|
f"Conflicting settings `{section1}.{name1}` and `{section2}.{name2}` "
|
|
|
|
"(DEPRECATED) detected in the configuration file. "
|
|
|
|
"This deprecated setting will be removed in the next versions of Freqtrade. "
|
|
|
|
f"Please delete it from your configuration and use the `{section1}.{name1}` "
|
|
|
|
"setting instead."
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def process_deprecated_setting(config: Dict[str, Any],
|
|
|
|
section1: str, name1: str,
|
2020-02-02 04:00:40 +00:00
|
|
|
section2: str, name2: str) -> None:
|
2019-10-08 23:37:29 +00:00
|
|
|
section2_config = config.get(section2, {})
|
|
|
|
|
|
|
|
if name2 in section2_config:
|
|
|
|
logger.warning(
|
|
|
|
"DEPRECATED: "
|
|
|
|
f"The `{section2}.{name2}` setting is deprecated and "
|
|
|
|
"will be removed in the next versions of Freqtrade. "
|
|
|
|
f"Please use the `{section1}.{name1}` setting in your configuration instead."
|
|
|
|
)
|
|
|
|
section1_config = config.get(section1, {})
|
|
|
|
section1_config[name1] = section2_config[name2]
|
|
|
|
|
|
|
|
|
|
|
|
def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
|
|
|
|
|
|
|
|
check_conflicting_settings(config, 'ask_strategy', 'use_sell_signal',
|
|
|
|
'experimental', 'use_sell_signal')
|
|
|
|
check_conflicting_settings(config, 'ask_strategy', 'sell_profit_only',
|
|
|
|
'experimental', 'sell_profit_only')
|
|
|
|
check_conflicting_settings(config, 'ask_strategy', 'ignore_roi_if_buy_signal',
|
|
|
|
'experimental', 'ignore_roi_if_buy_signal')
|
|
|
|
|
|
|
|
process_deprecated_setting(config, 'ask_strategy', 'use_sell_signal',
|
|
|
|
'experimental', 'use_sell_signal')
|
|
|
|
process_deprecated_setting(config, 'ask_strategy', 'sell_profit_only',
|
|
|
|
'experimental', 'sell_profit_only')
|
|
|
|
process_deprecated_setting(config, 'ask_strategy', 'ignore_roi_if_buy_signal',
|
|
|
|
'experimental', 'ignore_roi_if_buy_signal')
|
2019-10-30 15:32:22 +00:00
|
|
|
|
2019-11-23 18:48:15 +00:00
|
|
|
if not config.get('pairlists') and not config.get('pairlists'):
|
|
|
|
config['pairlists'] = [{'method': 'StaticPairList'}]
|
|
|
|
logger.warning(
|
|
|
|
"DEPRECATED: "
|
|
|
|
"Pairlists must be defined explicitly in the future."
|
|
|
|
"Defaulting to StaticPairList for now.")
|
|
|
|
|
2019-11-09 13:15:47 +00:00
|
|
|
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")
|
2019-11-19 18:33:04 +00:00
|
|
|
pl = {'method': 'VolumePairList'}
|
|
|
|
pl.update(config.get('pairlist', {}).get('config'))
|
|
|
|
config['pairlists'].append(pl)
|
2019-11-09 13:15:47 +00:00
|
|
|
|
2019-10-30 15:32:22 +00:00
|
|
|
if config.get('pairlist', {}).get('config', {}).get('precision_filter'):
|
|
|
|
logger.warning(
|
|
|
|
"DEPRECATED: "
|
|
|
|
f"Using precision_filter setting is deprecated and has been replaced by"
|
|
|
|
"PrecisionFilter. Please refer to the docs on configuration details")
|
2019-11-09 13:15:47 +00:00
|
|
|
config['pairlists'].append({'method': 'PrecisionFilter'})
|
2020-01-03 09:58:31 +00:00
|
|
|
|
2020-01-03 10:34:17 +00:00
|
|
|
if (config.get('edge', {}).get('enabled', False)
|
|
|
|
and 'capital_available_percentage' in config.get('edge', {})):
|
2020-01-03 09:58:31 +00:00
|
|
|
logger.warning(
|
|
|
|
"DEPRECATED: "
|
|
|
|
"Using 'edge.capital_available_percentage' has been deprecated in favor of "
|
|
|
|
"'tradable_balance_ratio'. Please migrate your configuration to "
|
|
|
|
"'tradable_balance_ratio' and remove 'capital_available_percentage' "
|
|
|
|
"from the edge configuration."
|
|
|
|
)
|