Tasks · 004-portfolio-weights
Portfolio weight calculation
Ordered, parallelizable work. Tests precede implementation. Drive through with
/spectastic.implement — one task per invocation.
004-portfolio-weights
Created
Read time
13 tasks across five phases. Setup → Foundational → User stories (US1·US2·US3) → Polish. Tasks marked [P] can run in parallel — different files, no dependency. Tests for a story MUST be written and failing before its implementation tasks start.
1 · Execution strategy
Implement US1 end-to-end. Ship. Iterate to US2 and US3 only after US1 is verified.
Setup → Foundational → US1 → US2 → US3 → Polish. Each story closes its conformance before the next opens.
One team on each user story after Foundational. Coordinate at shared seams (data model, API contracts) via the spec, not Slack.
2 · Phase 1 — Setup
3 · Phase 2 — Foundational
Shared infrastructure no story can ship without. Sequential where order matters.
4 · Phase 3a — US1 · Weights that sum to one
Tests (write & fail first)
|Σweights − 1| ≤ 1e-9, basis explicit in the output. src/test/java/io/spectastic/portfolio/PortfolioWeightsTest.javaImplementation
|MV| / Σ|MV| folded O(N) on read; the one double division. src/main/java/io/spectastic/portfolio/weights/PortfolioWeights.java5 · Phase 3b — US2 · Reweight on a tick
6 · Phase 3c — US3 · Shorts stay well-defined
Tests (write & fail first)
[0,1] sum to one; net guards a near-zero denominator; a price past the freshness bound is flagged stale. src/test/java/io/spectastic/portfolio/PortfolioWeightsTest.javaImplementation
ΣMV with documented sign semantics; guard instead of exploding weights; mark stale past the bound. src/main/java/io/spectastic/portfolio/weights/PortfolioWeights.java7 · Phase 4 — Polish
Σ weight² derived from the same weights. src/main/java/io/spectastic/portfolio/weights/PortfolioWeights.java/q/metrics, OpenAPI at /q/openapi; portfolio.analytics.enabled default false. src/main/java/io/spectastic/portfolio/weights/@QuarkusTest over /q/openapi. src/test/java/io/spectastic/portfolio/PortfolioWeightsTest.java8 · Dependencies
Setup → Foundational
Foundational → US1, US2, US3 (independent after this point)
US1, US2, US3 → Polish
9 · Change log
- Initial task breakdown. 13 tasks across five phases; TDD per story (US1 sum-to-one, US2 reweight-on-tick, US3 shorts + guard + staleness); polish for Herfindahl rollup, Micrometer timer, and diff-aware coverage.