From 91dc2b96fc3b08d849f05c15d6c30eb3d5eca562 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Mon, 8 Apr 2019 04:23:29 +0300 Subject: [PATCH 01/10] support for defaults in json.schema --- freqtrade/configuration.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/freqtrade/configuration.py b/freqtrade/configuration.py index fdd71f2f5..b0dc0b212 100644 --- a/freqtrade/configuration.py +++ b/freqtrade/configuration.py @@ -10,13 +10,14 @@ from logging.handlers import RotatingFileHandler from typing import Any, Dict, List, Optional import ccxt -from jsonschema import Draft4Validator, validate +from jsonschema import Draft4Validator, validators from jsonschema.exceptions import ValidationError, best_match from freqtrade import OperationalException, constants from freqtrade.misc import deep_merge_dicts from freqtrade.state import RunMode + logger = logging.getLogger(__name__) @@ -33,6 +34,27 @@ def set_loggers(log_level: int = 0) -> None: logging.getLogger('telegram').setLevel(logging.INFO) +def _extend_with_default(validator_class): + validate_properties = validator_class.VALIDATORS["properties"] + + def set_defaults(validator, properties, instance, schema): + for prop, subschema in properties.items(): + if "default" in subschema: + instance.setdefault(prop, subschema["default"]) + + for error in validate_properties( + validator, properties, instance, schema, + ): + yield error + + return validators.extend( + validator_class, {"properties": set_defaults}, + ) + + +ValidatorWithDefaults = _extend_with_default(Draft4Validator) + + class Configuration(object): """ Class to read and init the bot configuration @@ -318,7 +340,7 @@ class Configuration(object): :return: Returns the config if valid, otherwise throw an exception """ try: - validate(conf, constants.CONF_SCHEMA, Draft4Validator) + ValidatorWithDefaults(constants.CONF_SCHEMA).validate(conf) return conf except ValidationError as exception: logger.critical( From 4559a38172dcaf5925928e35304ef9ae39071368 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Mon, 8 Apr 2019 04:42:28 +0300 Subject: [PATCH 02/10] PoC: use defaults in json schema for some exchange options --- freqtrade/constants.py | 12 ++++++------ freqtrade/freqtradebot.py | 2 +- freqtrade/optimize/backtesting.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/freqtrade/constants.py b/freqtrade/constants.py index 5243eeb4a..e825fbd3f 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -172,11 +172,11 @@ CONF_SCHEMA = { 'exchange': { 'type': 'object', 'properties': { - 'name': {'type': 'string'}, - 'sandbox': {'type': 'boolean'}, - 'key': {'type': 'string'}, - 'secret': {'type': 'string'}, - 'password': {'type': 'string'}, + 'name': {'type': 'string', 'default': 'bittrex'}, + 'sandbox': {'type': 'boolean', 'default': False}, + 'key': {'type': 'string', 'default': ''}, + 'secret': {'type': 'string', 'default': ''}, + 'password': {'type': 'string', 'default': ''}, 'uid': {'type': 'string'}, 'pair_whitelist': { 'type': 'array', @@ -199,7 +199,7 @@ CONF_SCHEMA = { 'ccxt_config': {'type': 'object'}, 'ccxt_async_config': {'type': 'object'} }, - 'required': ['name', 'key', 'secret', 'pair_whitelist'] + 'required': ['pair_whitelist'] }, 'edge': { 'type': 'object', diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index a9676a64e..bceab8b23 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -53,7 +53,7 @@ class FreqtradeBot(object): self.rpc: RPCManager = RPCManager(self) - exchange_name = self.config.get('exchange', {}).get('name', 'bittrex').title() + exchange_name = self.config.get('exchange', {}).get('name').title() self.exchange = ExchangeResolver(exchange_name, self.config).exchange self.wallets = Wallets(self.config, self.exchange) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 3e4d642cb..513498766 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -66,7 +66,7 @@ class Backtesting(object): self.config['dry_run'] = True self.strategylist: List[IStrategy] = [] - exchange_name = self.config.get('exchange', {}).get('name', 'bittrex').title() + exchange_name = self.config.get('exchange', {}).get('name').title() self.exchange = ExchangeResolver(exchange_name, self.config).exchange self.fee = self.exchange.get_fee() From cb2f422e1c4a7a1677901e90ae33f641e9cdb44f Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Mon, 8 Apr 2019 11:19:45 +0300 Subject: [PATCH 03/10] make `name` option required again --- freqtrade/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freqtrade/constants.py b/freqtrade/constants.py index e825fbd3f..619508e73 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -172,7 +172,7 @@ CONF_SCHEMA = { 'exchange': { 'type': 'object', 'properties': { - 'name': {'type': 'string', 'default': 'bittrex'}, + 'name': {'type': 'string'}, 'sandbox': {'type': 'boolean', 'default': False}, 'key': {'type': 'string', 'default': ''}, 'secret': {'type': 'string', 'default': ''}, @@ -199,7 +199,7 @@ CONF_SCHEMA = { 'ccxt_config': {'type': 'object'}, 'ccxt_async_config': {'type': 'object'} }, - 'required': ['pair_whitelist'] + 'required': ['name', 'pair_whitelist'] }, 'edge': { 'type': 'object', From 3e4dd5019d5c354abb942958535227e0e02ef75e Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Mon, 8 Apr 2019 11:20:15 +0300 Subject: [PATCH 04/10] docs adjusted --- docs/bot-usage.md | 2 +- docs/configuration.md | 6 +++--- docs/telegram-usage.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/bot-usage.md b/docs/bot-usage.md index 55988985a..71d4aebb8 100644 --- a/docs/bot-usage.md +++ b/docs/bot-usage.md @@ -188,7 +188,7 @@ optional arguments: ### How to use **--refresh-pairs-cached** parameter? The first time your run Backtesting, it will take the pairs you have -set in your config file and download data from Bittrex. +set in your config file and download data from the Exchange. If for any reason you want to update your data set, you use `--refresh-pairs-cached` to force Backtesting to update the data it has. diff --git a/docs/configuration.md b/docs/configuration.md index f7e2a07f3..81bac42cf 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -40,10 +40,10 @@ Mandatory Parameters are marked as **Required**. | `ask_strategy.order_book_max` | 0 | Bot will scan from the top min to max Order Book Asks searching for a profitable rate. | `order_types` | None | Configure order-types depending on the action (`"buy"`, `"sell"`, `"stoploss"`, `"stoploss_on_exchange"`). [More information below](#understand-order_types). [Strategy Override](#parameters-in-the-strategy). | `order_time_in_force` | None | Configure time in force for buy and sell orders. [More information below](#understand-order_time_in_force). [Strategy Override](#parameters-in-the-strategy). -| `exchange.name` | bittrex | **Required.** Name of the exchange class to use. [List below](#user-content-what-values-for-exchangename). +| `exchange.name` | | **Required.** Name of the exchange class to use. [List below](#user-content-what-values-for-exchangename). | `exchange.sandbox` | false | Use the 'sandbox' version of the exchange, where the exchange provides a sandbox for risk-free integration. See [here](sandbox-testing.md) in more details. -| `exchange.key` | key | API key to use for the exchange. Only required when you are in production mode. -| `exchange.secret` | secret | API secret to use for the exchange. Only required when you are in production mode. +| `exchange.key` | '' | API key to use for the exchange. Only required when you are in production mode. +| `exchange.secret` | '' | API secret to use for the exchange. Only required when you are in production mode. | `exchange.pair_whitelist` | [] | List of currency to use by the bot. Can be overrided with `--dynamic-whitelist` param. | `exchange.pair_blacklist` | [] | List of currency the bot must avoid. Useful when using `--dynamic-whitelist` param. | `exchange.ccxt_rate_limit` | True | DEPRECATED!! Have CCXT handle Exchange rate limits. Depending on the exchange, having this to false can lead to temporary bans from the exchange. diff --git a/docs/telegram-usage.md b/docs/telegram-usage.md index 9d6877318..3947168c5 100644 --- a/docs/telegram-usage.md +++ b/docs/telegram-usage.md @@ -116,7 +116,7 @@ Return a summary of your profit/loss and performance. ### /forcebuy -> **BITTREX**: Buying ETH/BTC with limit `0.03400000` (`1.000000 ETH`, `225.290 USD`) +> **BITTREX:** Buying ETH/BTC with limit `0.03400000` (`1.000000 ETH`, `225.290 USD`) Note that for this to work, `forcebuy_enable` needs to be set to true. From 8bdbfbf19487263f2e41730e4e50af31ec47d0d5 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Thu, 11 Apr 2019 18:07:51 +0300 Subject: [PATCH 05/10] tests for options added --- freqtrade/tests/conftest.py | 65 +++++++++++++++++++++ freqtrade/tests/test_configuration.py | 83 +++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) diff --git a/freqtrade/tests/conftest.py b/freqtrade/tests/conftest.py index 0bff1d5e9..b19518ee7 100644 --- a/freqtrade/tests/conftest.py +++ b/freqtrade/tests/conftest.py @@ -197,6 +197,71 @@ def default_conf(): return configuration +@pytest.fixture(scope="function") +def all_conf(): + """ Returns validated configuration with all options """ + configuration = { + "max_open_trades": 1, + "stake_currency": "BTC", + "stake_amount": 0.001, + "fiat_display_currency": "USD", + "ticker_interval": '5m', + "dry_run": True, + "minimal_roi": { + "40": 0.0, + "30": 0.01, + "20": 0.02, + "0": 0.04 + }, + "stoploss": -0.10, + "unfilledtimeout": { + "buy": 10, + "sell": 30 + }, + "bid_strategy": { + "ask_last_balance": 0.0, + "use_order_book": False, + "order_book_top": 1, + "check_depth_of_market": { + "enabled": False, + "bids_to_ask_delta": 1 + } + }, + "ask_strategy": { + "use_order_book": False, + "order_book_min": 1, + "order_book_max": 1 + }, + "exchange": { + "name": "bittrex", + "sandbox": False, + "enabled": True, + "key": "key", + "secret": "secret", + "password": "password", + "pair_whitelist": [ + "ETH/BTC", + "LTC/BTC", + "XRP/BTC", + "NEO/BTC" + ], + "pair_blacklist": [ + "DOGE/BTC", + "HOT/BTC", + ] + }, + "telegram": { + "enabled": True, + "token": "token", + "chat_id": "0" + }, + "initial_state": "running", + "db_url": "sqlite://", + "loglevel": logging.DEBUG, + } + return configuration + + @pytest.fixture def update(): _update = Update(0) diff --git a/freqtrade/tests/test_configuration.py b/freqtrade/tests/test_configuration.py index 45e539c2f..edc6111da 100644 --- a/freqtrade/tests/test_configuration.py +++ b/freqtrade/tests/test_configuration.py @@ -617,3 +617,86 @@ def test_validate_tsl(default_conf): default_conf['trailing_stop_positive_offset'] = 0.015 Configuration(Namespace()) configuration._validate_config_consistency(default_conf) + + +# config['exchange'] subtree has required options in it +# so it cannot be omitted in the config +def test_load_config_default_exchange(all_conf) -> None: + del all_conf['exchange'] + + assert 'exchange' not in all_conf + + with pytest.raises(ValidationError, + match=r'\'exchange\' is a required property'): + configuration = Configuration(Namespace()) + configuration._validate_config_schema(all_conf) +### assert 'exchange' in all_conf + + +# config['exchange']['name'] option is required +# so it cannot be omitted in the config +def test_load_config_default_exchange_name(all_conf) -> None: + del all_conf['exchange']['name'] + + assert 'name' not in all_conf['exchange'] + + with pytest.raises(ValidationError, + match=r'\'name\' is a required property'): + configuration = Configuration(Namespace()) + configuration._validate_config_schema(all_conf) + + +# config['exchange']['sandbox'] option has default value: False +# so it can be omitted in the config and the default value +# should be present in the config as the option value +def test_load_config_default_exchange_sandbox(all_conf) -> None: + del all_conf['exchange']['sandbox'] + + assert 'sandbox' not in all_conf['exchange'] + + configuration = Configuration(Namespace()) + configuration._validate_config_schema(all_conf) + assert 'sandbox' in all_conf['exchange'] + assert all_conf['exchange']['sandbox'] is False + + +# config['exchange']['key'] option has default value: '' +# so it can be omitted in the config and the default value +# should be present in the config as the option value +def test_load_config_default_exchange_key(all_conf) -> None: + del all_conf['exchange']['key'] + + assert 'key' not in all_conf['exchange'] + + configuration = Configuration(Namespace()) + configuration._validate_config_schema(all_conf) + assert 'key' in all_conf['exchange'] + assert all_conf['exchange']['key'] == '' + + +# config['exchange']['secret'] option has default value: '' +# so it can be omitted in the config and the default value +# should be present in the config as the option value +def test_load_config_default_exchange_secret(all_conf) -> None: + del all_conf['exchange']['secret'] + + assert 'secret' not in all_conf['exchange'] + + configuration = Configuration(Namespace()) + configuration._validate_config_schema(all_conf) + assert 'secret' in all_conf['exchange'] + assert all_conf['exchange']['secret'] == '' + + +# config['exchange']['password'] option has default value: '' +# so it can be omitted in the config and the default value +# should be present in the config as the option value +def test_load_config_default_exchange_password(all_conf) -> None: + del all_conf['exchange']['password'] + + assert 'password' not in all_conf['exchange'] + + configuration = Configuration(Namespace()) + configuration._validate_config_schema(all_conf) + assert 'password' in all_conf['exchange'] + assert all_conf['exchange']['password'] == '' From c3a9db6488db2acff97d00c4e1fe20fc989fd8b4 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Thu, 11 Apr 2019 22:22:33 +0300 Subject: [PATCH 06/10] change comments to docstrings --- freqtrade/tests/test_configuration.py | 45 +++++++++++++++++---------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/freqtrade/tests/test_configuration.py b/freqtrade/tests/test_configuration.py index edc6111da..dde9ea271 100644 --- a/freqtrade/tests/test_configuration.py +++ b/freqtrade/tests/test_configuration.py @@ -619,9 +619,11 @@ def test_validate_tsl(default_conf): configuration._validate_config_consistency(default_conf) -# config['exchange'] subtree has required options in it -# so it cannot be omitted in the config def test_load_config_default_exchange(all_conf) -> None: + """ + config['exchange'] subtree has required options in it + so it cannot be omitted in the config + """ del all_conf['exchange'] assert 'exchange' not in all_conf @@ -630,12 +632,13 @@ def test_load_config_default_exchange(all_conf) -> None: match=r'\'exchange\' is a required property'): configuration = Configuration(Namespace()) configuration._validate_config_schema(all_conf) -### assert 'exchange' in all_conf -# config['exchange']['name'] option is required -# so it cannot be omitted in the config def test_load_config_default_exchange_name(all_conf) -> None: + """ + config['exchange']['name'] option is required + so it cannot be omitted in the config + """ del all_conf['exchange']['name'] assert 'name' not in all_conf['exchange'] @@ -646,10 +649,12 @@ def test_load_config_default_exchange_name(all_conf) -> None: configuration._validate_config_schema(all_conf) -# config['exchange']['sandbox'] option has default value: False -# so it can be omitted in the config and the default value -# should be present in the config as the option value def test_load_config_default_exchange_sandbox(all_conf) -> None: + """ + config['exchange']['sandbox'] option has default value: False + so it can be omitted in the config and the default value + should be present in the config as the option value + """ del all_conf['exchange']['sandbox'] assert 'sandbox' not in all_conf['exchange'] @@ -660,10 +665,12 @@ def test_load_config_default_exchange_sandbox(all_conf) -> None: assert all_conf['exchange']['sandbox'] is False -# config['exchange']['key'] option has default value: '' -# so it can be omitted in the config and the default value -# should be present in the config as the option value def test_load_config_default_exchange_key(all_conf) -> None: + """ + config['exchange']['key'] option has default value: '' + so it can be omitted in the config and the default value + should be present in the config as the option value + """ del all_conf['exchange']['key'] assert 'key' not in all_conf['exchange'] @@ -674,10 +681,12 @@ def test_load_config_default_exchange_key(all_conf) -> None: assert all_conf['exchange']['key'] == '' -# config['exchange']['secret'] option has default value: '' -# so it can be omitted in the config and the default value -# should be present in the config as the option value def test_load_config_default_exchange_secret(all_conf) -> None: + """ + config['exchange']['secret'] option has default value: '' + so it can be omitted in the config and the default value + should be present in the config as the option value + """ del all_conf['exchange']['secret'] assert 'secret' not in all_conf['exchange'] @@ -688,10 +697,12 @@ def test_load_config_default_exchange_secret(all_conf) -> None: assert all_conf['exchange']['secret'] == '' -# config['exchange']['password'] option has default value: '' -# so it can be omitted in the config and the default value -# should be present in the config as the option value def test_load_config_default_exchange_password(all_conf) -> None: + """ + config['exchange']['password'] option has default value: '' + so it can be omitted in the config and the default value + should be present in the config as the option value + """ del all_conf['exchange']['password'] assert 'password' not in all_conf['exchange'] From 6d2a1cfb442de9aa6ba11a008640df99b32553a8 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 24 Apr 2019 09:30:59 +0200 Subject: [PATCH 07/10] remove full-config in tests and load full_config file --- freqtrade/tests/conftest.py | 65 --------------------------- freqtrade/tests/test_configuration.py | 9 ++++ 2 files changed, 9 insertions(+), 65 deletions(-) diff --git a/freqtrade/tests/conftest.py b/freqtrade/tests/conftest.py index b19518ee7..0bff1d5e9 100644 --- a/freqtrade/tests/conftest.py +++ b/freqtrade/tests/conftest.py @@ -197,71 +197,6 @@ def default_conf(): return configuration -@pytest.fixture(scope="function") -def all_conf(): - """ Returns validated configuration with all options """ - configuration = { - "max_open_trades": 1, - "stake_currency": "BTC", - "stake_amount": 0.001, - "fiat_display_currency": "USD", - "ticker_interval": '5m', - "dry_run": True, - "minimal_roi": { - "40": 0.0, - "30": 0.01, - "20": 0.02, - "0": 0.04 - }, - "stoploss": -0.10, - "unfilledtimeout": { - "buy": 10, - "sell": 30 - }, - "bid_strategy": { - "ask_last_balance": 0.0, - "use_order_book": False, - "order_book_top": 1, - "check_depth_of_market": { - "enabled": False, - "bids_to_ask_delta": 1 - } - }, - "ask_strategy": { - "use_order_book": False, - "order_book_min": 1, - "order_book_max": 1 - }, - "exchange": { - "name": "bittrex", - "sandbox": False, - "enabled": True, - "key": "key", - "secret": "secret", - "password": "password", - "pair_whitelist": [ - "ETH/BTC", - "LTC/BTC", - "XRP/BTC", - "NEO/BTC" - ], - "pair_blacklist": [ - "DOGE/BTC", - "HOT/BTC", - ] - }, - "telegram": { - "enabled": True, - "token": "token", - "chat_id": "0" - }, - "initial_state": "running", - "db_url": "sqlite://", - "loglevel": logging.DEBUG, - } - return configuration - - @pytest.fixture def update(): _update = Update(0) diff --git a/freqtrade/tests/test_configuration.py b/freqtrade/tests/test_configuration.py index dde9ea271..dce76f25e 100644 --- a/freqtrade/tests/test_configuration.py +++ b/freqtrade/tests/test_configuration.py @@ -18,6 +18,15 @@ from freqtrade.state import RunMode from freqtrade.tests.conftest import log_has +@pytest.fixture(scope="function") +def all_conf(): + config_file = Path(__file__).parents[2] / "config_full.json.example" + print(config_file) + configuration = Configuration(Namespace()) + conf = configuration._load_config_file(str(config_file)) + return conf + + def test_load_config_invalid_pair(default_conf) -> None: default_conf['exchange']['pair_whitelist'].append('ETH-BTC') From 65a82d7ee62fc1891ab852a633a7bccbc76efe9b Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 24 Apr 2019 09:31:13 +0200 Subject: [PATCH 08/10] Add some missing default parameters --- config_full.json.example | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config_full.json.example b/config_full.json.example index 58d3d3ac6..7fc088585 100644 --- a/config_full.json.example +++ b/config_full.json.example @@ -56,8 +56,10 @@ }, "exchange": { "name": "bittrex", + "sandbox": false, "key": "your_exchange_key", "secret": "your_exchange_secret", + "password": "", "ccxt_config": {"enableRateLimit": true}, "ccxt_async_config": { "enableRateLimit": false, From a92d5f35699e7d4bf31a0cc1e7220916e1ff7849 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 24 Apr 2019 09:48:25 +0200 Subject: [PATCH 09/10] Parametrize default-param tests --- freqtrade/tests/test_configuration.py | 72 +++++++-------------------- 1 file changed, 17 insertions(+), 55 deletions(-) diff --git a/freqtrade/tests/test_configuration.py b/freqtrade/tests/test_configuration.py index dce76f25e..af94506b7 100644 --- a/freqtrade/tests/test_configuration.py +++ b/freqtrade/tests/test_configuration.py @@ -658,65 +658,27 @@ def test_load_config_default_exchange_name(all_conf) -> None: configuration._validate_config_schema(all_conf) -def test_load_config_default_exchange_sandbox(all_conf) -> None: +@pytest.mark.parametrize("keys", [("exchange", "sandbox", False), + ("exchange", "key", ""), + ("exchange", "secret", ""), + ("exchange", "password", ""), + ]) +def test_load_config_default_subkeys(all_conf, keys) -> None: """ - config['exchange']['sandbox'] option has default value: False - so it can be omitted in the config and the default value + Test for parameters with default values in sub-paths + so they can be omitted in the config and the default value should be present in the config as the option value """ - del all_conf['exchange']['sandbox'] + # Get first level key + key = keys[0] + # get second level key + subkey = keys[1] - assert 'sandbox' not in all_conf['exchange'] + del all_conf[key][subkey] + + assert subkey not in all_conf[key] configuration = Configuration(Namespace()) configuration._validate_config_schema(all_conf) - assert 'sandbox' in all_conf['exchange'] - assert all_conf['exchange']['sandbox'] is False - - -def test_load_config_default_exchange_key(all_conf) -> None: - """ - config['exchange']['key'] option has default value: '' - so it can be omitted in the config and the default value - should be present in the config as the option value - """ - del all_conf['exchange']['key'] - - assert 'key' not in all_conf['exchange'] - - configuration = Configuration(Namespace()) - configuration._validate_config_schema(all_conf) - assert 'key' in all_conf['exchange'] - assert all_conf['exchange']['key'] == '' - - -def test_load_config_default_exchange_secret(all_conf) -> None: - """ - config['exchange']['secret'] option has default value: '' - so it can be omitted in the config and the default value - should be present in the config as the option value - """ - del all_conf['exchange']['secret'] - - assert 'secret' not in all_conf['exchange'] - - configuration = Configuration(Namespace()) - configuration._validate_config_schema(all_conf) - assert 'secret' in all_conf['exchange'] - assert all_conf['exchange']['secret'] == '' - - -def test_load_config_default_exchange_password(all_conf) -> None: - """ - config['exchange']['password'] option has default value: '' - so it can be omitted in the config and the default value - should be present in the config as the option value - """ - del all_conf['exchange']['password'] - - assert 'password' not in all_conf['exchange'] - - configuration = Configuration(Namespace()) - configuration._validate_config_schema(all_conf) - assert 'password' in all_conf['exchange'] - assert all_conf['exchange']['password'] == '' + assert subkey in all_conf[key] + assert all_conf[key][subkey] == keys[2] From ad692c185ed35f981861eb02d9dda521481e4610 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 24 Apr 2019 09:55:53 +0200 Subject: [PATCH 10/10] Improve comment --- freqtrade/tests/test_configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/tests/test_configuration.py b/freqtrade/tests/test_configuration.py index 6fcae6aaa..09041dd3d 100644 --- a/freqtrade/tests/test_configuration.py +++ b/freqtrade/tests/test_configuration.py @@ -658,7 +658,7 @@ def test_load_config_default_subkeys(all_conf, keys) -> None: """ Test for parameters with default values in sub-paths so they can be omitted in the config and the default value - should be present in the config as the option value + should is added to the config. """ # Get first level key key = keys[0]