Improve documentation for config imports
This commit is contained in:
parent
cd2e49bb60
commit
9556af1e6c
@ -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.
|
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
|
## Configuration parameters
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ def load_from_files(files: List[str], base_path: Path = None, level: int = 0) ->
|
|||||||
config_sub = load_from_files(
|
config_sub = load_from_files(
|
||||||
config_tmp['add_config_files'], file.resolve().parent, level + 1)
|
config_tmp['add_config_files'], file.resolve().parent, level + 1)
|
||||||
files_loaded.extend(config_sub.get('config_files', []))
|
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))
|
files_loaded.insert(0, str(file))
|
||||||
|
|
||||||
|
@ -219,8 +219,9 @@ def test_from_recursive_files(testdatadir) -> None:
|
|||||||
assert conf['entry_pricing']
|
assert conf['entry_pricing']
|
||||||
assert conf['entry_pricing']['price_side'] == "same"
|
assert conf['entry_pricing']['price_side'] == "same"
|
||||||
assert conf['exit_pricing']
|
assert conf['exit_pricing']
|
||||||
# The other key comes from pricing2, which is imported by pricing.json
|
# The other key comes from pricing2, which is imported by pricing.json.
|
||||||
assert conf['exit_pricing']['price_side'] == "other"
|
# pricing.json is a level higher, therefore wins.
|
||||||
|
assert conf['exit_pricing']['price_side'] == "same"
|
||||||
|
|
||||||
assert len(conf['config_files']) == 4
|
assert len(conf['config_files']) == 4
|
||||||
assert 'testconfig.json' in conf['config_files'][0]
|
assert 'testconfig.json' in conf['config_files'][0]
|
||||||
|
Loading…
Reference in New Issue
Block a user