Skip to content

Commit f648ecd

Browse files
committed
add coin overrides guide and usage examples
1 parent 93c1ef4 commit f648ecd

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

docs/coin_overrides.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Coin Overrides Guide
2+
3+
Per-coin overrides let you tweak bot parameters (and a few live flags) for specific coins without
4+
forking the entire config. This guide explains what *is* and *is not* overrideable, how paths are
5+
resolved, and shows examples for both inline and file-based overrides.
6+
7+
## What can be overridden
8+
9+
Allowed fields are intentionally limited:
10+
11+
- **Bot params** (per side): grid spacing, double-down factors, EMA spans, initial qty/EMA dist,
12+
trailing/unstuck settings, wallet exposure limits, selected risk knobs (see the allowlist in
13+
`config_utils.get_allowed_modifications` for the full set).
14+
- **Live flags**: `forced_mode_long`, `forced_mode_short`, `leverage`.
15+
16+
Not overrideable: approved/ignored coins, exchange settings, arbitrary new keys—anything outside the
17+
allowlist is ignored.
18+
19+
## How overrides are loaded
20+
21+
1) `coin_overrides` is read from your main config. Keys should be coin tickers (e.g., `"XRP"`).
22+
2) If `override_config_path` is provided, the file is loaded. Relative paths are resolved against
23+
`live.base_config_path` (if set) or the current working directory.
24+
3) The override content is filtered to the allowed fields and diffed against the base config; only
25+
differing allowed fields are kept.
26+
4) During live startup, override keys are remapped to exchange symbols via `coin_to_symbol`; config
27+
lookups prefer these per-symbol values. In backtests, `prep_backtest_args` merges the override
28+
bot diffs directly per coin.
29+
30+
If the file cannot be found or yields no allowed diffs, the override is effectively empty and the
31+
base values are used.
32+
33+
## Inline override example
34+
35+
```json
36+
{
37+
"live": {
38+
"approved_coins": ["BTC", "XRP"],
39+
"base_config_path": "configs/running_config.json"
40+
},
41+
"coin_overrides": {
42+
"XRP": {
43+
"bot": {
44+
"long": {
45+
"entry_grid_spacing_pct": 0.05,
46+
"wallet_exposure_limit": 0.18
47+
},
48+
"short": {
49+
"entry_grid_spacing_pct": 0.055
50+
}
51+
},
52+
"live": {
53+
"forced_mode_long": "normal"
54+
}
55+
}
56+
}
57+
}
58+
```
59+
60+
## File-based override example
61+
62+
Main config:
63+
```json
64+
{
65+
"live": {
66+
"approved_coins": ["BTC", "BCH", "DOGE"],
67+
"base_config_path": "configs/running_config.json"
68+
},
69+
"coin_overrides": {
70+
"BCH": { "override_config_path": "configs/overrides/bch.json" },
71+
"DOGE": { "override_config_path": "configs/overrides/doge.json" }
72+
}
73+
}
74+
```
75+
76+
`configs/overrides/bch.json`:
77+
```json
78+
{
79+
"bot": {
80+
"long": {
81+
"entry_grid_spacing_pct": 0.021,
82+
"entry_initial_ema_dist": 0.001,
83+
"wallet_exposure_limit": 0.12
84+
},
85+
"short": {
86+
"entry_grid_spacing_pct": 0.019,
87+
"close_grid_markup_start": 0.004
88+
}
89+
},
90+
"live": {
91+
"forced_mode_short": "graceful_stop",
92+
"leverage": 4
93+
}
94+
}
95+
```
96+
97+
## How to validate overrides
98+
99+
- Run with `--log-level debug` to see which overrides were initialized and when a per-symbol override
100+
value is used.
101+
- Ensure `live.base_config_path` is set so relative `override_config_path` values resolve.
102+
- Verify the override file changes *allowed* fields versus the base config; disallowed keys are
103+
dropped.
104+
- Don’t expect per-override approved coin lists to take effect; keep the master coin list in the
105+
main config.
106+
107+
## Common pitfalls
108+
109+
- Bad paths: `override_config_path` not found → override silently empty.
110+
- Disallowed keys: fields outside the allowlist are ignored.
111+
- No diff: if the override matches the base on allowed fields, nothing is applied.
112+
- Mis-keyed coins: if a coin name cannot be mapped to an exchange symbol, the override is discarded.

0 commit comments

Comments
 (0)