feat(EXEC-001): add hedge strategy builder

This commit is contained in:
Bu5hm4nn
2026-03-27 22:33:20 +01:00
parent 554a41a060
commit 4620234967
9 changed files with 429 additions and 37 deletions

View File

@@ -0,0 +1,19 @@
id: EXEC-001
title: Strategy Builder
status: done
priority: P1
effort: L
depends_on:
- DATA-003
tags:
- strategies
- hedge
summary: The product now includes a thin hedge-page strategy builder that saves reusable custom templates and immediately compares their cost vs protection in the existing hedge charts.
completed_notes:
- Updated `app/services/strategy_templates.py` to persist templates under `data/strategy_templates.json`, seed from the shipped default template catalog, and expose a fail-closed `create_custom_template(...)` builder API.
- Added custom-template coverage in `tests/test_strategy_templates.py` for persistence, duplicate-name rejection, and custom catalog rendering.
- Updated `app/pages/hedge.py` to add a product-visible `Strategy Builder` card where users can choose strategy type, strike inputs, and expiration days, then save a reusable template from the UI.
- Saved templates now immediately participate in the existing hedge-page cost/protection comparison flow by auto-selecting the new template and reusing the existing payoff/cost charts on `/{workspace_id}/hedge`.
- Saved templates are reusable beyond the hedge page because the same app-global repository-backed template catalog now feeds `/backtests` and `/event-comparison` template selectors.
- The current thin builder scope supports custom protective puts and equal-weight two-leg put ladders; richer template management and more advanced builder controls can be added later as follow-up work.
- Local Docker validation closed the loop on the exact changed route: `/health` returned OK, `tests/test_hedge_builder_playwright.py` passed against the Docker-served app, and the saved template was verified as reusable from `/{workspace_id}/backtests`.