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#

TargetWhat gets removed
analysesanalyses row + snapshots/<uuid>.json.gz.
reviewsposition_reviews row.
backtestsbacktest_runs row + equity-curve and trade gzipped blobs.
notificationsnotification_log row.
http-logThe cross-process JSONL file (entries older than the cutoff are filtered out, the rest is rewritten).
allEvery target above.

The default target is all.

Flags#

FlagWhat it does
--older-than NCutoff in days (fractional supported, e.g. 0.5 for 12 h). Required.
--dry-runReport 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.