Merge pull request #1938 from hroff-1902/cleanup-setup-configuration
minor: setup_configuration() cleanup
This commit is contained in:
commit
b0c5286e8a
@ -5,8 +5,9 @@ from typing import Any, Dict
|
|||||||
from filelock import FileLock, Timeout
|
from filelock import FileLock, Timeout
|
||||||
|
|
||||||
from freqtrade import DependencyException, constants
|
from freqtrade import DependencyException, constants
|
||||||
from freqtrade.configuration import Configuration
|
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
|
from freqtrade.utils import setup_utils_configuration
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -17,12 +18,7 @@ def setup_configuration(args: Namespace, method: RunMode) -> Dict[str, Any]:
|
|||||||
:param args: Cli args from Arguments()
|
:param args: Cli args from Arguments()
|
||||||
:return: Configuration
|
:return: Configuration
|
||||||
"""
|
"""
|
||||||
configuration = Configuration(args, method)
|
config = setup_utils_configuration(args, method)
|
||||||
config = configuration.load_config()
|
|
||||||
|
|
||||||
# Ensure we do not use Exchange credentials
|
|
||||||
config['exchange']['key'] = ''
|
|
||||||
config['exchange']['secret'] = ''
|
|
||||||
|
|
||||||
if method == RunMode.BACKTEST:
|
if method == RunMode.BACKTEST:
|
||||||
if config['stake_amount'] == constants.UNLIMITED_STAKE_AMOUNT:
|
if config['stake_amount'] == constants.UNLIMITED_STAKE_AMOUNT:
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
from freqtrade.utils import setup_configuration, start_list_exchanges
|
from freqtrade.utils import setup_utils_configuration, start_list_exchanges
|
||||||
from freqtrade.tests.conftest import get_args
|
from freqtrade.tests.conftest import get_args
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
def test_setup_configuration():
|
def test_setup_utils_configuration():
|
||||||
args = [
|
args = [
|
||||||
'--config', 'config.json.example',
|
'--config', 'config.json.example',
|
||||||
]
|
]
|
||||||
|
|
||||||
config = setup_configuration(get_args(args), RunMode.OTHER)
|
config = setup_utils_configuration(get_args(args), RunMode.OTHER)
|
||||||
assert "exchange" in config
|
assert "exchange" in config
|
||||||
|
assert config['exchange']['dry_run'] is True
|
||||||
assert config['exchange']['key'] == ''
|
assert config['exchange']['key'] == ''
|
||||||
assert config['exchange']['secret'] == ''
|
assert config['exchange']['secret'] == ''
|
||||||
|
|
||||||
|
@ -10,15 +10,16 @@ from freqtrade.state import RunMode
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_configuration(args: Namespace, method: RunMode) -> Dict[str, Any]:
|
def setup_utils_configuration(args: Namespace, method: RunMode) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Prepare the configuration for the Hyperopt module
|
Prepare the configuration for utils subcommands
|
||||||
:param args: Cli args from Arguments()
|
:param args: Cli args from Arguments()
|
||||||
:return: Configuration
|
:return: Configuration
|
||||||
"""
|
"""
|
||||||
configuration = Configuration(args, method)
|
configuration = Configuration(args, method)
|
||||||
config = configuration.load_config()
|
config = configuration.load_config()
|
||||||
|
|
||||||
|
config['exchange']['dry_run'] = True
|
||||||
# Ensure we do not use Exchange credentials
|
# Ensure we do not use Exchange credentials
|
||||||
config['exchange']['key'] = ''
|
config['exchange']['key'] = ''
|
||||||
config['exchange']['secret'] = ''
|
config['exchange']['secret'] = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user