freqtrade_origin/freqtrade/configuration/config_setup.py

31 lines
768 B
Python
Raw Normal View History

2019-06-12 09:33:20 +00:00
import logging
from typing import Any
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
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__)
def setup_utils_configuration(
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)
config = configuration.get_config()
2019-06-12 09:33:20 +00:00
# Ensure these modes are using Dry-run
if set_dry:
2024-05-12 14:29:24 +00:00
config["dry_run"] = True
validate_config_consistency(config, preliminary=True)
2019-06-12 09:33:20 +00:00
return config