The session-level metalabel P(our ORB profits today) — the one lever that survives out-of-sample. Backtested on 266 prod sessions (walk-forward): trade-always (trained subset): -0.111R/session, 36% hit meta_v1 GATED (trades best ~32% of days): -0.004R/session, 48% hit delta +0.107R in-sample, +0.128R OOS (recent 80 sessions), improves across folds It does NOT make the bot profitable — it takes a bleeding strategy to roughly flat by sitting out the worst ~2/3 of sessions. threshold_v1 rule gates too little to matter; meta_v1 (walk-forward GBM) is the signal. Leaky full-fit (+0.61R) >> walk-forward confirms the discipline was load-bearing; the OOS holding is the evidence the +0.078R is real, not look-ahead. Changes: - research/regime.py: batch minute-bar load per session (64k per-fire round-trips -> ~266 queries; fixed a >5min build to ~3min) + incremental label pass (skip already-labeled sessions; --rebuild forces full). Nightly cost now ~one new day. - docker-compose.yml + truenas-compose.yml: scheduler runs build-features + score (both models) before `experiments run`, nightly. ALL-SHADOW — does NOT gate live trading (that stays owner-gated Step 5). - admin_api.py + admin.html: POST /api/regime/run (detached) + GET /api/regime/status + a Run/Status button — the panel had no way to trigger this. - plans/011 + docs/research/regime_notes.md (6-book distillation) + plans 008/009 docs. Prod state (shadow, rollback = DROP regime_features/regime_scores + DELETE experiments WHERE id LIKE 'regime%'): 266 feature rows, 532 scores, 2 experiments registered. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
61 lines
8.4 KiB
Markdown
61 lines
8.4 KiB
Markdown
# Implementation Plans — next enhancement milestone
|
||
|
||
Generated by the improve skill on 2026-07-13 at commit `d54a2a9`, from an
|
||
8-cluster recon sweep (~95 evidence-cited findings), a 5-frame ideation pass
|
||
(48 raw ideas → 14 merged candidates, all 14 verified sound by a fresh-context
|
||
spot-check against HEAD), and a design-fit review of the dashboard additions.
|
||
Companion design artifacts: `docs/ideation/2026-07-13-next-milestone-ideation.html`
|
||
(ranked ideas + bases), `docs/ideation/momentum-architecture-current.{drawio,png}`,
|
||
`docs/ideation/momentum-milestone-featureset.{drawio,png}`.
|
||
|
||
Execute in the order below unless dependencies say otherwise. Each executor:
|
||
read the plan fully before starting, honor its STOP conditions, and update
|
||
your row when done.
|
||
|
||
## Execution order & status
|
||
|
||
| Plan | Title | Priority | Effort | Depends on | Status |
|
||
|------|-------|----------|--------|------------|--------|
|
||
| 001 | Production safety rails — CI test gate, dead-man's switch, pg_dump backup | P1 | S | — | DONE |
|
||
| 002 | Dead-weight deletion — schwab/, grafana/, dead modules/tables/projections | P2 | S | 001 | DONE |
|
||
| 003 | Money-path hardening — daily self-restart, positive-evidence contract, reconcile, cage count | P1 | M | 001 | DONE |
|
||
| 004 | Learning flywheel — one population module, scheduled eod_replay + nightly_tune, atomic writes | P1 | M | 001 (002 rec.) | DONE |
|
||
| 005 | Entry-path unification + decision receipts | P2 | M | 001, 003, 004 | DONE |
|
||
| 006 | Experiment OS — pre-registered counterfactual experiments over logged fires (flagship) | P1 | L | 004 (005 rec.) | DONE |
|
||
| 007 | Operator control plane — dashboard truth + kill switch + effective config (step 1 = prod bug fix, ship early) | P2 | M | 001, 003 (006 for ledger data) | DONE |
|
||
| 008 | Conversion-signal model — measure if the labeled data separates winners | P1 | L | 006, 004 | **MEASURED 2026-07-14 (corrected): the 0.514 was the liq1-dominated MIX. Scoped to live v1: CV AUC 0.641 — REAL signal, but it is ~entirely the VWAP gate the bot ALREADY runs (above-VWAP +1R 35.4% vs below 12.7%). Residual within above-VWAP = 0.526 ≈ noise. RVOL-fallback added (read-only test 2026-07-14): 0.526→0.535, within noise — RVOL adds nothing beyond VWAP. Verdict: VWAP is the whole story for current features; no second indicator. Only market-context + catalyst remain untested (forward-accrual only, negative prior). The lever is a different setup (premarket), not more ORB filters.** |
|
||
| 010 | Premarket shadow entry — prove a FILL-ABLE edge before any live premarket order | P2 | L | 006, 009 | **NO-GO (Step 1 measured 2026-07-15): premarket is a paper-fill mirage. pm1+fat-tail-exit expR: −0.50R @0.5% fill, −1.27R @1% (realistic thin book), −2.74R @2%, vs the ORB's −0.11R. The 22-min fat tail can't outrun the 1-2% premarket spread. STOP — do not build the live shadow track. The ORB's 5-min wait exists to trade in penny-spread regular-session liquidity.** |
|
||
| 009 | Feature-population prerequisite — instrument v1/pm1 (market context, RVOL fallback, catalyst-on), then re-run 008's probe | P2 | L | 006, 008 | code DONE, awaiting supervised rebuild+probe (market context + thin-name RVOL fallback + SPY/QQQ ingest + enrichment-on + committed probe all landed & tested; Steps 4-5 rebuild/AUC run supervised) |
|
||
| 011 | Regime gate — a FREE-data daily signal deciding whether the ORB trades today; metalabel `P(our ORB profits this session)`, proven in the harness (walk-forward) before any live gate | P1 | L | 006, 004, 009 | **CODE DONE + REVIEW-APPROVED (worktree `worktree-agent-a2709a9c0f0bb7d65`, commit `5cef4aa`), awaiting SUPERVISED real-data adjudication. Built: `research/regime.py` (probe + walk-forward `build-features`/`score`), `iv_regime_gate` harness intervention (keep-or-zero, fail-open), `regime_threshold_v1`+`regime_meta_v1` JSONs, 5 tests incl. the mutate-the-future leakage guard. Reviewer re-ran: 9 new + 35 existing experiments tests green, ruff clean, live paths untouched. HMM rung skipped (statsmodels absent). Research: `docs/research/regime_notes.md`. SUPERVISED next step (hits production Postgres — NOT done by the executor): `python3 -m research.regime probe` (Step-0 STOP gate) → `build-features` → `score --model threshold_v1`/`meta_v1` → register+run+adjudicate the two experiments → record expR_delta + OOS/fold results here. Review findings to fold in at that point: (1) `tape_regime` = earliest setup's at-trigger (~9:35) reading, not strictly pre-open — fine for the shadow harness, must be lagged before Step-5 live promotion; (2) minor: `_load_regime_favorable` model_version has no None-guard (both JSONs set it, fail-open if absent). Honest prior unchanged: most promising AND most curve-fit-prone (~150-260 sessions); walk-forward + threshold-floor + OOS decide GO vs "no free-data regime signal at this sample size".** |
|
||
|
||
Status values: TODO | IN PROGRESS | DONE | BLOCKED (with one-line reason) | REJECTED (with one-line rationale)
|
||
|
||
## Expected drift (read before running any plan's drift check)
|
||
|
||
Every plan stamps `d54a2a9` and its drift check diffs against that commit. Executed
|
||
in order, later plans WILL see diffs from earlier ones (compose scheduler/db-backup
|
||
blocks from 001/003/004/006, workflow test job from 001, trading_execution/
|
||
run_live_paper changes from 003/004/005, telegram_bot from 001). That is EXPECTED
|
||
drift: verify only that the plan's quoted code excerpts still exist semantically
|
||
(line numbers may shift); STOP only on changes NOT attributable to a completed
|
||
plan in this series (check the status table above).
|
||
|
||
## Dependency notes
|
||
|
||
- **001 first, always**: it is the gate that makes every other plan's image push test-verified. 007's step 1 (the POST `NameError` import fix) is a production bug fix that may be cherry-picked ahead of everything.
|
||
- 002 before the refactor-heavy plans (004/005) so they diff against a smaller surface; its production `DROP TABLE` section runs only after 001's backup exists.
|
||
- 003 before 005/007: both build on its clean-shutdown/flatten semantics. Note the documented interaction: 007's `flatten_all` command must not trigger 003's daily-restart exit (see 007 STOP conditions).
|
||
- 004 before 006: every experiment population MUST come from `strategy/population.py` — running experiments against a look-ahead population re-creates the exact artifact class (vr1/liq1) this milestone exists to kill.
|
||
- 005 before 006 is recommended (receipts enrich replay + rank_one_bullet needs rank), but 006's bar-path replay works without it — the rank experiment just starts underpowered.
|
||
- **Postgres provisioning (owner)**: the only new DDL in the milestone is plan 006's `experiments` / `experiment_runs` / `experiment_verdicts` tables (full DDL in `plans/006-experiment-os.md`). Plans 001–005/007 add no tables. The owner said they will provision the database once the plan is solid — that means: apply 006's DDL (or let the harness's idempotent schema-apply do it on first run), and after 002 lands, optionally run its operator `DROP TABLE` list post-backup.
|
||
|
||
## Findings considered and rejected (do not re-audit)
|
||
|
||
- **Retest/pullback entry logic, scale-out partials, close-above-trigger confirmation from folklore** — refuted in `docs/research/entry_conversion_research.md` (external evidence + in-house tests); the research doc's "explicit do-nots".
|
||
- **Selection levers (confirmation-speed gate, float gating, liquidity floors, VWAP-reclaim promotion, liquid-breakout, leading-gainer detector, premarket-volume slices)** — refuted at year scale per project memory; the validated population stays as-is.
|
||
- **Reviving the NiceGUI controlroom** — owner preference: :8765 is the dashboard.
|
||
- **LISTEN/NOTIFY for dashboard change detection** — deferred, not rejected: the shared cached signal (007 step 2) is the sufficient lazy fix; NOTIFY is the named upgrade path.
|
||
- **TimescaleDB / pg extensions** — not required at current scale (README's own assessment); revisit only if event/bar volume grows past what the hot-path index handles.
|
||
- **`strategy/regime.py` deletion** — already deleted at HEAD; recon reference was stale. NOTE: plan 011 introduces a NEW, unrelated `research/regime.py` — an *offline* metalabel scorer (session-level `P(ORB profits today)`), not the deleted live regime module. Different file, different purpose; do not conflate.
|
||
- **Schwab account sync revival for human-vs-bot comparison** — the only non-delete rationale for schwab/; owner may veto 002's schwab deletion if that comparison is still wanted (plan 002 grep-gates it either way).
|