From 92c6f62bb8d26b7f3731cc8cfbf478a8e7519d73 Mon Sep 17 00:00:00 2001 From: Bu5hm4nn Date: Mon, 23 Mar 2026 22:22:30 +0100 Subject: [PATCH] Add worktree config and comprehensive roadmap with user stories --- .pi/worktree.json | 15 +++ docs/ROADMAP.md | 249 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 264 insertions(+) create mode 100644 .pi/worktree.json create mode 100644 docs/ROADMAP.md diff --git a/.pi/worktree.json b/.pi/worktree.json new file mode 100644 index 0000000..dd09cce --- /dev/null +++ b/.pi/worktree.json @@ -0,0 +1,15 @@ +{ + "dir": ".worktrees", + "branchPrefix": "feature/", + "linkEnvFiles": true, + "postCreate": [ + "python3 -m venv .venv 2>/dev/null || true", + ".venv/bin/pip install -r requirements.txt -r requirements-dev.txt 2>/dev/null || pip install -r requirements.txt -r requirements-dev.txt", + "cp .env.example .env.local 2>/dev/null || true", + "echo 'Worktree $(basename $PWD) ready. Use docker compose up -d to start Redis.'" + ], + "preRemove": [ + "docker compose down -v 2>/dev/null || true", + "rm -rf .venv" + ] +} diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md new file mode 100644 index 0000000..9949915 --- /dev/null +++ b/docs/ROADMAP.md @@ -0,0 +1,249 @@ +# Vault Dashboard Roadmap + +## Overview +A prioritized roadmap for the Vault Dashboard Lombard loan hedging platform. + +## Legend +- **Priority**: P0 (Critical), P1 (High), P2 (Medium), P3 (Low) +- **Dependencies**: Features tagged with `[depends: ID]` require the named feature to be completed first +- **Effort**: S (Small), M (Medium), L (Large) + +--- + +## Phase 1: Data Foundation (Foundation Layer) + +### DATA-001: Live Price Feed Integration [P0, M] **[foundation]** +**As a** portfolio manager, **I want** real-time gold price updates **so that** my LTV calculations reflect current market conditions. + +**Acceptance Criteria:** +- Integrate yfinance/live data for GLD spot price +- Update prices every 30 seconds via WebSocket +- Display last update timestamp +- Fallback to cached data if feed fails + +**Technical Notes:** +- Create `app/services/price_feed.py` with async price fetching +- Extend existing WebSocket manager in `app/services/websocket.py` +- Store prices in Redis with 60s TTL + +**Dependencies:** None + +--- + +### DATA-002: Options Chain Data [P0, L] **[depends: DATA-001]** +**As a** trader, **I want** live options chain data for GLD **so that** I can evaluate protective put strikes and premiums. + +**Acceptance Criteria:** +- Fetch options chains from yfinance or IBKR API +- Display strikes, expiration dates, bid/ask, implied volatility +- Cache chain data for 5 minutes +- Support filtering by expiration (30/60/90 days) + +**Technical Notes:** +- Create `app/services/options_chain.py` +- Add `/api/options/chain` endpoint +- Update Options Chain page (`app/pages/options.py`) + +**Dependencies:** DATA-001 + +--- + +### DATA-003: Greeks Calculation [P1, M] **[depends: DATA-002]** +**As a** risk manager, **I want** real-time Greeks calculations **so that** I understand my hedge sensitivity. + +**Acceptance Criteria:** +- Calculate Delta, Gamma, Theta, Vega for selected options +- Display Greeks in options chain view +- Show portfolio-level Greeks if positions held +- Use Black-Scholes model with live IV + +**Technical Notes:** +- Create `app/services/pricing.py` with B-S model +- Add QuantLib integration (optional dependency) +- Cache calculations for performance + +**Dependencies:** DATA-002 + +--- + +## Phase 2: Portfolio & Risk (Core Features) + +### PORT-001: Portfolio State Management [P0, M] **[depends: DATA-001]** +**As a** user, **I want** to configure my actual portfolio (gold value, loan amount) **so that** LTV calculations match my real position. + +**Acceptance Criteria:** +- Settings page with editable portfolio parameters +- Store config in Redis/database +- Validate LTV < 100% +- Show current vs recommended collateral + +**Technical Notes:** +- Extend `app/pages/settings.py` +- Create `app/models/portfolio.py` with Pydantic models +- Add persistence layer (Redis JSON or SQLite) + +**Dependencies:** DATA-001 + +--- + +### PORT-002: Alert Notifications [P1, M] **[depends: PORT-001]** +**As a** risk manager, **I want** alerts when LTV approaches margin call thresholds **so that** I can take action before liquidation. + +**Acceptance Criteria:** +- Configurable alert thresholds (default: 70%, 75%) +- Browser push notifications +- Email notifications (optional) +- Alert history log + +**Technical Notes:** +- Create `app/services/alerts.py` +- Integrate browser notifications API +- Add `/api/alerts/configure` endpoint +- Background task to check thresholds + +**Dependencies:** PORT-001 + +--- + +### PORT-003: Historical LTV Chart [P2, M] **[depends: PORT-001]** +**As a** user, **I want** to see my LTV history over time **so that** I can identify trends and stress periods. + +**Acceptance Criteria:** +- Store LTV snapshots every hour +- Display 7/30/90 day charts +- Show margin call threshold line +- Export data as CSV + +**Technical Notes:** +- Create `app/services/history.py` +- Use TimescaleDB or Redis TimeSeries (optional) +- Integrate with existing chart components + +**Dependencies:** PORT-001 + +--- + +## Phase 3: Strategy Execution (Advanced Features) + +### EXEC-001: Strategy Builder [P1, L] **[depends: DATA-003]** +**As a** trader, **I want** to build and compare hedging strategies **so that** I can choose optimal protection. + +**Acceptance Criteria:** +- Select strategy type (protective put, collar, laddered) +- Choose strikes and expirations +- See P&L payoff diagrams +- Compare cost vs protection level + +**Technical Notes:** +- Extend `app/pages/hedge.py` +- Create `app/services/strategy_builder.py` +- Add payoff chart visualization +- Store strategy templates + +**Dependencies:** DATA-003 + +--- + +### EXEC-002: IBKR Order Integration [P2, L] **[depends: EXEC-001]** +**As a** authorized user, **I want** to execute hedge trades directly from the dashboard **so that** I can act quickly on recommendations. + +**Acceptance Criteria:** +- IBKR API connection (paper trading first) +- Preview order with estimated fill +- One-click execution +- Order tracking and status updates + +**Technical Notes:** +- Create `app/services/broker.py` with IBKR API +- Add paper/live mode toggle +- Store credentials securely +- Order audit log + +**Dependencies:** EXEC-001 + +--- + +### EXEC-003: Position Monitoring [P2, M] **[depends: EXEC-002]** +**As a** portfolio manager, **I want** to see my open hedge positions **so that** I know my current protection status. + +**Acceptance Criteria:** +- Display open options positions +- Show expiration countdown +- Calculate net Greeks exposure +- Alert on approaching expiration + +**Technical Notes:** +- Create positions table/view +- Sync with IBKR positions +- Update portfolio Greeks calculation + +**Dependencies:** EXEC-002 + +--- + +## Phase 4: Reporting & Analytics (Polish) + +### RPT-001: Strategy Report Generation [P3, M] **[depends: EXEC-001]** +**As a** compliance officer, **I want** PDF reports of hedging decisions **so that** I can document risk management. + +**Acceptance Criteria:** +- Generate PDF with strategy rationale +- Include P&L scenarios +- Date range selection +- Export to email/share + +**Technical Notes:** +- Use reportlab or weasyprint +- Create `app/services/reporting.py` +- Add download endpoint + +**Dependencies:** EXEC-001 + +--- + +### RPT-002: What-If Analysis [P3, L] **[depends: DATA-003]** +**As a** risk manager, **I want** to simulate gold price drops **so that** I can stress test my protection. + +**Acceptance Criteria:** +- Slider to adjust gold price scenarios (-10%, -20%, etc.) +- Show portfolio P&L impact +- Display hedge payoff under scenarios +- Compare protected vs unprotected + +**Technical Notes:** +- Extend strategy builder with scenario mode +- Add sensitivity analysis +- Interactive chart updates + +**Dependencies:** DATA-003 + +--- + +## Dependency Graph + +``` +DATA-001 (Price Feed) +├── DATA-002 (Options Chain) +│ ├── DATA-003 (Greeks) +│ │ ├── EXEC-001 (Strategy Builder) +│ │ │ ├── EXEC-002 (IBKR Orders) +│ │ │ │ └── EXEC-003 (Position Monitoring) +│ │ │ └── RPT-001 (Reports) +│ │ └── RPT-002 (What-If) +│ └── PORT-001 (Portfolio Config) +│ ├── PORT-002 (Alerts) +│ └── PORT-003 (History) +``` + +--- + +## Implementation Priority Queue + +1. **DATA-001** - Unblock all other features +2. **PORT-001** - Enable user-specific calculations +3. **DATA-002** - Core options data +4. **DATA-003** - Risk metrics +5. **PORT-002** - Risk management safety +6. **EXEC-001** - Core user workflow +7. **EXEC-002** - Execution capability +8. Remaining features