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

@@ -13,7 +13,6 @@ notes:
- Pre-alpha policy: we may cut or replace old features without backward compatibility until alpha is declared.
- Alpha migration policy: once alpha is declared, compatibility only needs to move forward; backward migrations are not required.
priority_queue:
- EXEC-001
- EXEC-002
- DATA-002A
- DATA-001A
@@ -21,6 +20,7 @@ priority_queue:
- BT-003
- BT-002A
recently_completed:
- EXEC-001
- BT-001C
- BT-002
- PORT-003
@@ -42,7 +42,6 @@ states:
- DATA-002A
- DATA-001A
- OPS-001
- EXEC-001
- EXEC-002
- BT-003
- BT-002A
@@ -59,6 +58,7 @@ states:
- SEC-001
- SEC-001A
- EXEC-001A
- EXEC-001
- BT-001
- BT-001A
- BT-001C

View File

@@ -1,13 +0,0 @@
id: EXEC-001
title: Strategy Builder
status: backlog
priority: P1
effort: L
depends_on:
- DATA-003
tags: [strategies, hedge]
summary: Build and compare hedge strategies from the product UI.
acceptance_criteria:
- Select strategy type, strikes, and expirations.
- Show payoff diagrams and compare cost vs protection.
- Store strategy templates for reuse.

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`.