Saltar al contenido principal

Strategy Development (Consolidated /strategy-development/*)

The Vite frontend exposes a single consolidated umbrella for every strategy-authoring + strategy-testing surface under /strategy-development/*. Twelve sibling sub-routes share the same persistent left sub-nav, a run-summary KPI strip, and a cross-route React context so navigating between (say) Compose → Simulate → Compare-Models keeps all the inputs (deployment id, symbols, time window, feature row, last task id) coherent.

Surfaces

RouteComponentWraps
/strategy-developmentStrategyDevIndexRouteredirects to /strategy-development/composer
/strategy-development/composerStrategyComposerGET /strategies/components + POST /strategies
/strategy-development/simulationSimulationCreatordispatches to BotRuntime / LobBacktestEngine / AlphaBacktestExperiment / RLRuntime / paper
/strategy-development/ideationIdeationConsolePOST /agents/ideate (router_complete + research_papers RAG)
/strategy-development/single-predictSinglePredictRoutePOST /ml/test/single
/strategy-development/predict-batchPredictBatchRoutePOST /ml/test/batch (now Iceberg-aware) + POST /ml/test/upload-csv
/strategy-development/compare-modelsCompareModelsRoutePOST /ml/test/compare
/strategy-development/scenario-perturbationScenarioPerturbationRoutePOST /ml/test/scenario
/strategy-development/historical-evalHistoricalEvalRoutePOST /ml/evaluate + GET /ml/evaluations/{task_id}
/strategy-development/live-testLiveTestRoutePOST /ml/live-test/start + useLiveStream
/strategy-development/run-comparatorRunComparatorchained pairwise POST /ml/test/compare
/strategy-development/document-libraryDocumentLibraryGET /rag/papers, POST /rag/papers/upload, POST /rag/papers/{id}/synthesize
/strategy-development/libraryStrategyLibraryRouteGET /strategies/components (read-only registry browser)

Cross-route state

alphaswarm_client/src/components/strategy-dev/StrategyDevContext.tsx holds the shared selection (deploymentId, deploymentIdB, symbols, start, end, featureRowText, perturbations, lastTaskId, lastRunSummary, composerYaml, strategyId). The context is backed by localStorage under the key alphaswarm.strategy-dev.selection.v1 so a hard refresh doesn't lose state.

Sub-routes use useStrategyDev() to read + patch the selection:

const { selection, setSelection } = useStrategyDev();
setSelection({ deploymentId: "abc", lastTaskId: res.task_id });

KPI strip

RunKpiStrip reads selection.lastRunSummary and renders Sharpe / total return / max DD / hit rate / trades in the standard MetricsGrid. The strip is intentionally idle when no run has been launched in the current session so the surface stays calm.

Hard-rule alignment

  • Frontend rule (.cursor/rules/frontend.mdc): every long-running task is consumed via the existing useChatStream / useLiveStream hooks so the WS pipeline + kill-switch + sandbox banner all stay intact.
  • AGENTS rule 2: LLM-driven surfaces (IdeationConsole, PaperSynthesisDrawer) route through router_complete server-side.
  • AGENTS rule 4: progress framing is unchanged — sub-routes never publish to Redis directly; they always go through _progress.emit on the backend.

How to add a sub-route

  1. Create alphaswarm_client/src/routes/strategy-development/<slug>/page.tsx wrapping the new component.
  2. Add the new component under alphaswarm_client/src/components/strategy-dev/.
  3. Register the route in alphaswarm_client/src/routes.tsx's DYNAMIC_ROUTES entry for strategy-development.
  4. Add a StrategyDevSubRoute entry to alphaswarm_client/src/components/strategy-dev/SubNav.tsx so the new route appears in the persistent left nav.

Legacy

The legacy webui /ml/test page is now superseded by this consolidated surface. Bookmarks still work because the flat REAL_ROUTES entry is preserved, but the sidebar no longer surfaces it.