MarketDeck docs

alerts

Rule-based alert checks with routing, history, and watch mode.

marketdeck alerts stores risk-based alert rules and evaluates them against the current unified risk snapshot. Alert checks are CLI-first: rules, routing, history, and schedules are all inspectable through marketdeck alerts ... --format json.

Usage#

marketdeck alerts <list|add|enable|disable|remove|check|watch|routes|history|schedule|test|metrics> [flags]
SubcommandWhat it does
listShow stored alert rules.
addCreate a rule for a supported risk metric.
enable <id>Enable a disabled rule.
disable <id>Disable a rule without deleting it.
remove <id>Delete one rule.
checkEvaluate enabled rules once.
watchRepeatedly evaluate enabled rules and route triggers.
routesList, add, remove, or test delivery targets.
historyShow recently triggered alerts and delivery results.
schedulePrint cron/systemd-friendly commands.
testEvaluate an ephemeral rule without saving it.
metricsList supported metric names.

Rules#

marketdeck alerts add --metric gross_leverage --op gt --value 2 --severity warning
marketdeck alerts add --metric min_liquidation_distance_pct --op lt --value 15 --severity critical
marketdeck alerts add --metric margin_usage_pct --op gt --value 70 --severity warning
marketdeck alerts add --metric max_drawdown_pct --op gt --value 20 --drawdown-from 2026-01-01
marketdeck alerts add --metric scenario_equity_after_usd --op lt --value 5000 --scenario BTC=-10,ETH=-15
marketdeck alerts add --metric kill_switch_required --op eq --value 1 --max-gross-leverage 2 --min-liq-distance-pct 15
marketdeck alerts disable alert-abc123
marketdeck alerts enable alert-abc123
marketdeck alerts check --format json
marketdeck alerts check --route --record

check does not route by default, so reports and scripts can inspect alert state without sending notifications. Add --route to deliver triggered alerts through configured routes, and --record to persist triggered events to alert history.

Risk v2 Metrics#

alerts can evaluate the same derived checks exposed by marketdeck risk:

MetricMeaning
min_liquidation_distance_pctLowest estimated liquidation distance across active positions.
margin_usage_pctHighest wallet/exchange margin usage percentage.
max_drawdown_pctMaximum paper equity drawdown from persisted equity snapshots.
scenario_equity_after_usdEquity after configured per-coin shocks.
kill_switch_required1 when configured limit, liquidation, or scenario gates breach; otherwise 0.

Scenario and kill-switch rules can persist their own parameters with the rule:

marketdeck alerts test --metric scenario_equity_after_usd --op lt --value 5000 --scenario BTC=-10 --format json
marketdeck alerts test --metric kill_switch_required --op eq --value 1 --max-gross-leverage 2 --min-liq-distance-pct 15

Routes#

marketdeck alerts routes list
marketdeck alerts routes add --target telegram --min-severity warning
marketdeck alerts routes add --target desktop --min-severity info
marketdeck alerts routes add --target webui
marketdeck alerts routes test telegram
marketdeck alerts routes remove route-abc123

Supported targets:

TargetBehavior
telegramSends through marketdeck telegram send.
desktopAppends to the local notification log.
webuiRecords a route delivery in alert history for UI consumers.
jsonStores the triggered payload in the delivery result.

Watch And Schedule#

marketdeck alerts watch --interval 60
marketdeck alerts watch --interval 60 --limit 10 --no-route
marketdeck alerts schedule --interval 5

watch routes triggered alerts by default. schedule prints command, cron, and systemd snippets for periodic one-shot checks.