Rule anatomy
| Field | Required | Description |
|---|---|---|
portfolioWalletId | Yes | The wallet the rule applies to |
yieldSourceId | Yes | The yield source to watch (UUID or public id, e.g. morpho-gauntlet-usdc) |
metric | Yes | The metric to evaluate (see Metrics) |
ruleKind | Yes | absolute or relative_change_bps (see Rule kinds) |
comparator | Yes | lt, lte, gt, or gte |
thresholdValue | Yes | The value to compare against |
windowSeconds | For velocity | Lookback window, required for relative_change_bps, omitted for absolute |
outcome | No | alert (default), prevent_additional_allocation, or exit_position |
approvalMode | For non-alert | automatic or approval_required |
name | No | A human label |
status | No | active (default) or paused |
Metrics
Rules can be written against these per-source metrics:| Metric | Meaning | Units |
|---|---|---|
available_withdrawal_liquidity_usd | Liquidity currently available to withdraw from the source | USD |
tvl_usd | Total value locked in the source | USD |
apy_bps | Current annualized yield | Basis points (100 bps = 1%) |
GET /v2/wallets/risk/metrics.
Rule kinds
Absolute (ruleKind: "absolute") compares the current reading directly against thresholdValue. thresholdValue must be non-negative and windowSeconds is omitted.
Alert when available withdrawal liquidity drops below $100,000,000:Velocity (metric: available_withdrawal_liquidity_usd,comparator: lt,thresholdValue: 100000000.
ruleKind: "relative_change_bps") compares the change in the metric over windowSeconds against thresholdValue, expressed in basis points. Here thresholdValue is a signed bps change and windowSeconds is required.
Alert when TVL falls 15% or more over 24h:metric: tvl_usd,ruleKind: relative_change_bps,comparator: lte,thresholdValue: -1500,windowSeconds: 86400.
For velocity rules,
thresholdValue may be negative (a drop). For absolute rules it must be non-negative.Comparators
lt (below), lte (at or below), gt (above), gte (at or above). A rule breaches when the reading satisfies the comparator against the threshold.
Outcome and approval mode
Theoutcome decides what happens when the rule breaches:
alert: notify only. NoapprovalMode.prevent_additional_allocation: block new allocation into the source while the alert is open.exit_position: exit the position when the rule breaches.
approvalMode of automatic (acts on its own) or approval_required (waits for you to approve). See Outcomes and Actions for the full behavior of each.
Create a rule
Rules back-evaluate on creation. If the source is already breaching the threshold when you create the rule, the alert opens immediately instead of waiting for the next metric reading. The same happens when you re-enable a paused rule.
Edit a rule
Patch any subset of fields. The wallet and yield source are fixed at creation and cannot be changed. To watch a different source, create a new rule.Pause and resume a rule
Setstatus to paused to turn a rule off, or active to turn it back on.
Delete a rule
Next steps
- Outcomes and Actions: what each outcome does and how to approve actions.
- Alerts and Recovery: the alert lifecycle and automatic recovery.