<!-- https://zunderlabs.com/docs/reference/config · Markdown version of the page -->

# Config keys

Every key of guard.toml with its default and bounds. Generated from the code at release; this skeleton lists the keys that exist in code today.

:::note[Planned]
`guard.toml` is planned for Guard 1.0. At release, the table between the markers below is generated from the code (`validate()` of each config struct), so defaults and bounds cannot drift from what Guard enforces. Until then it holds the keys that exist in code today, with their source.
:::

## Conventions

- **Fractions are fractions.** `0.02` means 2%. Basis points end in `_bps`.
- **Decimals are strings.** `risk_per_trade = "0.02"`, not `0.02`. A float is refused, so no value is rounded on the way in.
- **Unknown keys are refused**, so a typo is an error, not a silently ignored setting.
- **Every key has bounds** checked at start-up, upper as well as lower.
- **A missing key takes its default.**

## Your config

```toml
network = "paper"                 # "paper" | "testnet" | "mainnet"
listen = "127.0.0.1:8547"

[risk]                            # zunder-risk RiskLimits
risk_per_trade = "0.02"
max_open_risk = "0.06"
max_leverage = "5"
daily_loss_stop = "0.06"
drawdown_stop = "0.25"
# max_trading_equity_usd = "2000" # optional equity cap, off by default

[policy]                          # Guard's own rules
stop_policy = "attach"            # "attach" | "refuse"
default_stop_distance = "0.02"
min_liquidation_distance = "0.10"
max_position_fraction = "2"
round_trip_cost_bps = "11"
# allowed_coins = ["BTC", "ETH"]  # unset: all markets
```

## Keys

{/* GENERATED:config-keys:start — replaced at build time from zunder-guard-core; do not edit by hand */}

### `[risk]`: in code today (`RiskLimits`, `crates/zunder-risk/src/limits.rs`)

| Key | Default | Bounds | Rule |
|---|---|---|---|
| `risk_per_trade` | `"0.02"` | > 0, ≤ 1; ≤ `max_open_risk` | (g) max loss at the stop |
| `max_open_risk` | `"0.06"` | > 0, ≤ 1; ≥ `risk_per_trade` | (e) max open risk |
| `max_leverage` | `"5"` | > 0, ≤ 100 | (c) max leverage |
| `daily_loss_stop` | `"0.06"` | > 0, ≤ 1 | (h) daily loss stop |
| `drawdown_stop` | `"0.25"` | > 0, ≤ 1 | (i) drawdown halt |
| `max_trading_equity_usd` | unset (no cap) | > 0, ≤ 2500 in Zunder's code; Guard's bound not decided | [equity cap](https://zunderlabs.com/docs/concepts/equity-cap) |

### `[policy]`: in the website's judge today (`SiteRules`, `crates/zunder-risk-wasm/src/judge.rs`)

| Key | Default | Bounds | Rule |
|---|---|---|---|
| `stop_policy` | `"attach"` | `"attach"`, `"refuse"` | (b) protective stop |
| `default_stop_distance` | `"0.02"` | ≥ 0.001, ≤ 0.25 | (b) where an attached stop goes |
| `min_liquidation_distance` | `"0.10"` | ≥ 0.01, ≤ 0.5 | (d) |
| `max_position_fraction` | `"2"` | > 0, ≤ 50, ≤ `max_leverage` | (f) |
| `round_trip_cost_bps` | `"11"` | ≥ 0, ≤ 500 | costs counted into (g) |
| `allowed_coins` | unset: all markets | ≤ 1,000 coins | (a) |

### Execution: in code today (`SessionConfig`, `crates/zunder-exec/src/session.rs`)

| Key | Default | Bounds | Meaning |
|---|---|---|---|
| `entry_ttl_ms` | `10000` | 1000–30000 | an entry reaching the venue later than this is refused there |
| `stop_slippage` | `"0.10"` | > 0, ≤ 0.5 | how far beyond its trigger a stop may fill |
| `exit_slippage` | `"0.05"` | > 0, ≤ 0.5 | how far from the reference price an exit may fill |
| `flatten_attempts` | `3` | 1–10 | attempts to close one position |
| `recovery` | `"conservative"` | `"conservative"`, `"report_only"` | what a restart does with unknown orders and stopless positions |
| `startup_wait` | `true` | bool | refuse entries for 35 s after start-up |

### Guard only: planned

| Key | Default | Meaning |
|---|---|---|
| `network` | `"paper"` | mainnet also needs the command line ([networks](https://zunderlabs.com/docs/concepts/networks#mainnet)) |
| `listen` | `"127.0.0.1:8547"` | where bots connect |
| `relay.enabled` | `false` | [relay](https://zunderlabs.com/docs/tools/relay) |
| `telemetry.enabled` | `false` | anonymous heartbeat |

{/* GENERATED:config-keys:end */}
