2019-06-12 09:33:20 +00:00
|
|
|
import logging
|
2020-01-26 12:17:26 +00:00
|
|
|
from typing import Any, Dict
|
2019-06-12 09:33:20 +00:00
|
|
|
|
2021-06-08 19:20:35 +00:00
|
|
|
from freqtrade.enums import RunMode
|
2020-09-28 17:39:41 +00:00
|
|
|
|
2020-01-26 12:55:48 +00:00
|
|
|
from .config_validation import validate_config_consistency
|
|
|
|
from .configuration import Configuration
|
2020-09-28 17:39:41 +00:00
|
|
|
|
2019-06-12 09:33:20 +00:00
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2024-03-14 19:31:34 +00:00
|
|
|
def setup_utils_configuration(
|
2024-05-12 14:29:24 +00:00
|
|
|
args: Dict[str, Any], method: RunMode, *, set_dry: bool = True
|
|
|
|
) -> 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()
|
2021-06-25 17:13:31 +00:00
|
|
|
:param method: Bot running mode
|
2019-06-12 09:33:20 +00:00
|
|
|
:return: Configuration
|
|
|
|
"""
|
|
|
|
configuration = Configuration(args, method)
|
2019-08-16 12:42:44 +00:00
|
|
|
config = configuration.get_config()
|
2019-06-12 09:33:20 +00:00
|
|
|
|
2021-09-13 18:00:22 +00:00
|
|
|
# Ensure these modes are using Dry-run
|
2024-03-14 19:31:34 +00:00
|
|
|
if set_dry:
|
2024-05-12 14:29:24 +00:00
|
|
|
config["dry_run"] = True
|
2022-05-01 07:53:34 +00:00
|
|
|
validate_config_consistency(config, preliminary=True)
|
2019-06-12 09:33:20 +00:00
|
|
|
|
|
|
|
return config
|