60 lines
9.6 KiB
Markdown
60 lines
9.6 KiB
Markdown
# RP21 — Run a bounded volatility-filter signal study
|
||
|
||
Parent E12. Priority P2 / research workflow evidence. Complexity M. Dependencies RP20, A02, A03, RP03, R08 and R09. The owner's continuation follows the recommendation for an AI-driven signal study. Use existing research APIs, isolated candidate execution and canonical Rust accounting. No new simulator, strategy framework, optimization, human catalog approval or paper/live activation. Root owns the real-data receipts; an independent reviewer audits retained inputs/results. Do not parallelize submissions or inspect holdouts before their declared phase.
|
||
|
||
## Predeclaration before September price inspection
|
||
|
||
Hypothesis: during positive trailing trend, buying a sufficiently negative deviation from the recent mean may recover; suppressing entries during high observed return volatility may improve cost-adjusted outcomes relative to the identical unfiltered rule. This is an unvalidated hypothesis, not discovered alpha. Compare two fixed variants without numeric optimization. Same code, dataset, native engine, risk, seed and costs; only `regimeFilter` changes.
|
||
|
||
Use the existing `createMeanReversionStrategy` artifact produced by `scripts/package-builtin-strategies.ts`, then add `execution: { kind: 'isolated-candidate/v1', warmupBars: 60 }`. Preserve its program, parameter schema, artifact, build and source/lock identities. Publish each cycle entry as an isolated candidate. This exact adaptation already exists in `test/postgres/ai-research-workflow.test.ts`; it avoids duplicating indicator and checkpoint code. Do not create a new candidate source, narrow the known schema, or evaluate uploaded source on the host. Both entries embed the identical package. The current factory's observation-count indicators and pending-entry/exit behavior remain authoritative strategy semantics.
|
||
|
||
Fixed parameters for both entries:
|
||
|
||
```json
|
||
{
|
||
"lookbackPeriod": 20,
|
||
"trendPeriod": 60,
|
||
"momentumPeriod": 3,
|
||
"volatilityPeriod": 20,
|
||
"entryZScore": 1.5,
|
||
"exitZScore": 0,
|
||
"minTrendReturn": 0,
|
||
"minMomentumReturn": -0.01,
|
||
"maxVolatility": 0.002,
|
||
"minNotionalVolume": "0",
|
||
"regimeFilter": "volatility"
|
||
}
|
||
```
|
||
|
||
Control changes only `regimeFilter` to `none`. Both have `grid: {}`. Fixed execution order: filtered, then control. Do not revise thresholds, windows, costs or risk after seeing outcomes. Zero trades, identical outcomes, risk halts and failed runs remain findings; they do not authorize another search.
|
||
|
||
One asset: stored EOD `AAPL.US`, five-minute bars, September 2024 regular sessions, 13:30–20:00 UTC. Overall warmup starts September 3; trading starts September 4 and ends September 30. Split by complete sessions:
|
||
|
||
| Phase | Warmup start UTC | Trading start UTC | Trading end UTC | Expected source bars |
|
||
| --- | --- | --- | --- | --- |
|
||
| Training | Sep 3 13:30 | Sep 4 13:30 | Sep 16 20:00 | 780 |
|
||
| Validation | Sep 16 13:30 | Sep 17 13:30 | Sep 23 20:00 | 468 |
|
||
| Test | Sep 23 13:30 | Sep 24 13:30 | Sep 30 20:00 | 468 |
|
||
|
||
Recipe `version: 1`, `labelHorizonMs: 0`. Every phase has 78 warmup bars. Expected whole source: 1,560 bars across 20 sessions. These are expectations, not permission to repair incomplete data. Freeze the exact UTC millisecond recipe in the local execution plan before capture. Use declared half-open session queries; validate all selected rows, gaps, duplicates, identifiers and OHLCV. Preserve raw bytes, source metadata, calendar/action evidence, dataset hash and strict preview receipts. No silent null-volume coercion, resampling, interpolation or date substitution.
|
||
|
||
Preserve RP18 financial policy: capital 10000, seed 42, ownerBudget `1000`, feeRate `0.001`, halfSpreadRate `0.0001`, slippageRate `0.0001`, latencyMs 0, participationRate `0.01`, maxOrderQuantity/maxPositionQuantity `10`, maxSymbolExposure/maxGrossExposure `1500`, maxDailyLoss `100`, maxDrawdownAmount `200`, maxMarkAgeMs 300000, periodsPerYear 252, annualRiskFreeRate 0. Owner budget remains a strategy sizing input, not a native strategy allocation limit.
|
||
|
||
Each variant has one training run, two server-selected holdouts, then two full-template cost runs (automatic baseline and stress with feeRate `0.002`, slippageRate `0.0005`, unchanged spread). **At most ten admitted trials**, one attempt each. Failed candidates may yield fewer. Costs run only after the respective holdout report is sealed; whole-window cost diagnostics are not another untouched holdout. Accounts restart for every run, holdings may persist overnight, and terminal valuation uses native marking rather than an invented closing fill.
|
||
|
||
## Existing workflow and acceptance
|
||
|
||
1. Commit this predeclaration and package a clean source revision. Validate both fixed parameter sets against the retained package; assert the complete package is identical between entries. Run the existing strategy, chronological-cycle and isolated/native candidate regressions. Check the pinned sandbox is installed and usable; never fall back to host execution. No new parity implementation is needed for an unchanged bundled strategy.
|
||
2. Retain files in the new ignored `.data/research-pilots/aapl-202409-signals/` directory, without overwriting previous pilot artifacts. Create a separate project and frozen template through current APIs. The existing approved built-in may anchor the non-executed template grant; do not submit additional baseline SMA runs or manufacture another human review. Record source vintage/selection limitations before admission.
|
||
3. Provision a dedicated credential through the normal API composition fixed by RP20. Scope it to this project/template with own-candidate opt-in. Limits: maxActiveTrials 2, maxTrialsPerExperiment 3, maxBarEvaluationsPerExperiment 3120, maxAttemptWallMs 300000, maxAttempts 1. Three counts training plus both holdouts; two whole-window cost trials determine the larger bar budget. `maxTotalTrials: 10` is the local predeclared cycle bound, not a server lifetime quota. Finalize template/build inputs before granting. Keep the credential private and revoke after completion or terminal abandonment; revocation does not cancel accepted jobs.
|
||
4. Use `scripts/examples/research-cycle.ts` and its typed client, with a new private fsynced receipt journal and `validateResearchCycle` reporting ten total trials. Persist complete candidate definitions before any performance read. Drive only receipt-admitted run IDs through the existing runner; verify project/template/experiment/agent/version before execution. Never drain unrelated queues or restart the entire CLI after ambiguous non-idempotent writes. Use existing receipt recovery and exact-key retries only where supported.
|
||
5. Reopen results, sealed holdout reports and costs through APIs. Retain every failure and diagnostic. Compare net return, drawdown, fills, fees, final native risk state and metric availability. Save AI-origin findings linked to exact run/report evidence; distinguish hypothesis from observation. No significance/profitability claim or automatic promotion. Without retained as-of regime labels, report a filter ablation, not performance attribution to distinct market regimes.
|
||
6. Independent audit checks all admitted IDs against the ten-trial bound, shared artifact/financial policy, only the declared parameter/cost differences, phase data/selection hashes, no holdout-driven edits, cash/fees/owner/equity reconciliation and evidence references. Reopen the project, saved results and findings in the web app without new submissions. Record exact executed tests and limitations, then commit concise execution evidence and close the story.
|
||
|
||
Relevant paths: `apps/stock/orchestrator/src/strategies/canonical-mean-reversion.ts`, `apps/stock/orchestrator/src/contracts/builtin-strategy.ts`, `scripts/package-builtin-strategies.ts`, `scripts/examples/research-cycle.ts`, `scripts/research-client.ts`, `apps/stock/web-api/src/services/research-agents.service.ts`, `apps/stock/web-api/src/services/validation-preview.ts`, and the existing `.data/research-pilots/aapl-202410-month/` preparation/receipt examples. Tests: `test/integration/canonical-mean-reversion.test.ts`, `test/integration/canonical-regime-research.test.ts`, `test/integration/candidate-sandbox.test.ts`, `scripts/test/research-cycle.test.ts`, `test/postgres/ai-research-workflow.test.ts`. Real fixture tests require disposable stores and the installed OS isolation profile. No benchmark work.
|
||
|
||
## Evidence and limitations
|
||
|
||
Availability-only inventory on October 27 read timestamps/counts/null-volume counts, not prices or returns: September contains 20 dates, each 79 raw rows from 13:30 through 20:00 UTC. Strict session capture must establish that the selected 78 rows are valid. September was chosen from coverage before its price inspection, but is earlier than the already inspected October pilots: this is **predeclared retrospective holdout research**, not prospective validation after October or a guarantee against global selection bias. Fixed AAPL selection and a dataset captured in 2026 are also retrospective. The small partitions cannot establish durable alpha.
|
||
|
||
[Nasdaq's Labor Day notice](https://www.nasdaqtrader.com/TraderNews.aspx?id=ETA2024-49), [2024 calendar](https://www.nasdaqtrader.com/content/technicalsupport/2024tradingcalendar.pdf) and [hours](https://www.nasdaq.com/market-activity/stock-market-holiday-schedule) support the declared sessions. An action-free September is an inference from [Apple's dividend/split history](https://investor.apple.com/dividend-history/), not a certified action feed. [EOD's intraday documentation](https://eodhd.com/financial-apis/intraday-historical-data-api) describes UTC bar starts and delayed finalization/corrections: interval-end availability is a simulated zero-delay assumption, not observed vendor arrival.
|