stock-bot/docs/development/backlog/tasks/S02.md

3.9 KiB

S02 — Adapt one SMA strategy for the first canonical path

Parent epic: E4. Priority/severity: P1 / High. Relative complexity: M. Recommended specialization: TypeScript strategy/quant engineering.

Scheduling source of truth: manifest entry S02. No task is authorized until the plan is approved. Dependencies and decision references below describe the design; the manifest controls current readiness.

Evidence and root cause

Intended behavior and implementation scope

Adapt one existing SMA strategy first into the approved TS decision API using the current registry alias. Remove direct ModeManager/ExecutionService access for this version; parameters and owner budget are explicit. Keep other strategies/version readers intact and visibly legacy/unsupported on the canonical path until adapted. A native conformance strategy is test-only, not a competing production implementation.

Exclusions

No unrelated refactor, new service or broker activation.

Likely files and ownership

  • apps/stock/orchestrator/src/strategies/StrategyRegistry.ts
  • apps/stock/orchestrator/src/strategies/BaseStrategy.ts
  • apps/stock/orchestrator/src/strategies/builtin/SmaCrossoverStrategy.ts
  • apps/stock/orchestrator/src/strategies/builtin/MeanReversionStrategy.ts

Write locks: strategy-builtins. One agent owns this change. Lock names do not override actual overlapping files.

Dependencies and blockers

Implementation requires S01 integrated.

No additional economic-policy approval is needed for this narrowly scoped task.

Parallel eligibility: only with disjoint actual files and reserved write locks; read FIRST-WAVE.md for the initial exact ownership boundaries.

Acceptance criteria

  • The versioned SMA strategy runs via the Rust session with no service injection and isolated checkpoint state.
  • Entry/exit and owner sizing are explicit; prior registry alias still resolves to a deliberate version/capability.
  • A new canonical run can ship after this one strategy passes; migrating every native/TS built-in is not a release gate.

Mandatory tests

  • sma_registry_alias, owner_budget_sizing, sma_checkpoint_restore, sma_next_open_trace.
  • Legacy strategy/result compatibility remains; no wholesale BaseStrategy deletion.

Apply relevant quality gates. Report exact commands/results and unavailable checks; named new cases are requirements, not claims of existing passing tests.

Regression risks and rollback

Compatibility or lifecycle regression; preserve frozen inputs, old results and existing failure tests. Keep migrations additive and previous results readable. Do not add a switch that restores a correctness defect. Versioned cutover/migration is required only when persisted contracts or active engines change; never silently fall back to old economics.

Handoff

Report scope changes (if any), fixture expectations, API/schema changes, measurements, remaining limitations and commit/PR references once authorized. Request independent review; only the integration/planning owner may mark the manifest done.