← all research
REJECTED

"Phase 8 — Monitoring & safety (Alpaca crypto)"

2026-08-15

Status: DONE (2026-08-15) · Suite: 310 passed, 2 skipped (+6 tests in tests/test_alpaca_monitor.py)

What was built

data/alpaca/monitor.py — one-shot health/status report + drift journal for the raw store, the signal chain and the executor. CLI: python -m data.alpaca.monitor [--json-out file].

Checks

CheckOutput
store completenessper (symbol, type, timeframe): day partitions missing in the last 7 days (missing_partitions)
freshnessseconds since the newest stored bar/trade/quote per kind (latest_ts, freshness_s)
quote stalenessPhase-2 quote_age_s tail value per symbol (or raw-quote fallback); flagged when > 15 min
modelsper (SYM|TF) loaded h*.json metadata (n_pred, IC, fee hurdles)
executor stateopen position (qty/entry/exit bar), last signal, trade count, risk halt flag
safetyAPI keys present, canonical symbols only, no-short rule (enforced at the executor/broker boundary), maker/taker fee bps

StatusReport is a dataclass → stable JSON schema; the CLI also writes processed_dir/alpaca/monitor/latest.json for dashboards/alerting without touching the trading process.

Design notes

Deployment checklist (next, outside this phase)

  1. Full backfill completes → build features → datasets → run Phase-4 pipeline → produce OOS preds → Phase-5 backtests per (symbol, TF, h).
  2. Calibrate threshold_bps on OOS, then re-validate on a held-out tail.
  3. Wire BarExecutor + RiskManager into a paper runner against AlpacaBroker(paper=True); verify orders land and fills match the paper book.
  4. Schedule monitor on a cron/daemon; alert on quote_age_s > 15min, missing partitions, risk halts.