MarketDeck docs
prune
Drop old rows + their gzipped sibling files by retention age.
marketdeck prune is the unified retention surface. Each target removes both its DB row and any sidecar files (gzipped snapshots, equity curves, trade lists) atomically, so a partial prune can't leave the file system out of sync with the schema.
Usage#
marketdeck prune [<target>] --older-than <days> [--dry-run]
Targets#
| Target | What gets removed |
|---|---|
analyses | analyses row + snapshots/<uuid>.json.gz. |
reviews | position_reviews row. |
backtests | backtest_runs row + equity-curve and trade gzipped blobs. |
notifications | notification_log row. |
http-log | The cross-process JSONL file (entries older than the cutoff are filtered out, the rest is rewritten). |
all | Every target above. |
The default target is all.
Flags#
| Flag | What it does |
|---|---|
--older-than N | Cutoff in days (fractional supported, e.g. 0.5 for 12 h). Required. |
--dry-run | Report counts without deleting anything. |
Examples#
marketdeck prune --older-than 90 --dry-run --format text
marketdeck prune analyses --older-than 30 --format text
marketdeck prune backtests --older-than 365
marketdeck prune http-log --older-than 14
What is NOT pruned#
paper_analysis_snapshots is never targeted by prune. Those rows are evidence frozen at position-open time; they outlive the rolling analyses history and are removed via FK cascade only when the parent position itself is deleted (schema v10).
Cron#
A daily prune is a fine cron candidate:
0 4 * * * /usr/bin/marketdeck prune --older-than 90 >> /tmp/marketdeck-prune.log 2>&1
The daemon's maintenance loop can also run prune on a schedule — pick whichever fits your workflow.