Improve documentation for config imports

This commit is contained in:
Matthias 2022-04-10 10:14:34 +02:00
parent cd2e49bb60
commit 9556af1e6c
3 changed files with 34 additions and 3 deletions

View File

@ -80,6 +80,36 @@ This is similar to using multiple `--config` parameters, but simpler in usage as
This is equivalent to the example above - but `config-private.json` is specified as cli argument.
??? Note "config collision handling"
If the same configuration setting takes place in both `config.json` and `config-import.json`, then the parent configuration wins.
In the below case, `max_open_trades` would be 3 after the merging - as the reusable "import" configuration has this key overwritten.
``` json title="user_data/config.json"
{
"max_open_trades": 3,
"stake_currency": "USDT",
"add_config_files": [
"config-import.json"
]
}
```
``` json title="user_data/config-import.json"
{
"max_open_trades": 10,
"stake_amount": "unlimited",
}
```
Resulting combined configuration:
``` json title="Result"
{
"max_open_trades": 10,
"stake_currency": "USDT",
"stake_amount": "unlimited"
}
```
## Configuration parameters

View File

@ -103,7 +103,7 @@ def load_from_files(files: List[str], base_path: Path = None, level: int = 0) ->
config_sub = load_from_files(
config_tmp['add_config_files'], file.resolve().parent, level + 1)
files_loaded.extend(config_sub.get('config_files', []))
deep_merge_dicts(config_sub, config_tmp)
config_tmp = deep_merge_dicts(config_tmp, config_sub)
files_loaded.insert(0, str(file))

View File

@ -219,8 +219,9 @@ def test_from_recursive_files(testdatadir) -> None:
assert conf['entry_pricing']
assert conf['entry_pricing']['price_side'] == "same"
assert conf['exit_pricing']
# The other key comes from pricing2, which is imported by pricing.json
assert conf['exit_pricing']['price_side'] == "other"
# The other key comes from pricing2, which is imported by pricing.json.
# pricing.json is a level higher, therefore wins.
assert conf['exit_pricing']['price_side'] == "same"
assert len(conf['config_files']) == 4
assert 'testconfig.json' in conf['config_files'][0]