Verify · 004-portfolio-weights
Portfolio weight calculation
How to run, demo, and verify this feature — aggregated from the spec and tasks, with a Run/Demo block grounded in the run that actually happened.
A derived view — regenerate with spectastic verify 004-portfolio-weights; do not hand-edit. The trace links are aggregated from the bundle; only the Run/Demo block is authored, from the real run.
1 · Run / Demo
PortfolioWeightsTest shows gross-basis weights in [0,1] summing to one within 1e-9 with a short present, net-basis weights carrying sign, the Herfindahl index matching its closed form, and an empty book yielding no weights rather than a divide-by-zero.2 · Verification trace
Every success criterion, traced to its acceptance scenario and the test task that closes it.
| Success criterion | Acceptance | Proof (tests) |
|---|---|---|
| SC-001 | US1 | T-100 |
| SC-002 | US3 | T-300 |
3 · Observables trace
Every reliability NFR, traced to its SLO — objective, SLI, and golden signal.
| NFR | Objective | SLI | Signal |
|---|---|---|---|
| NFR-001 | p99 < 500 µs full-book (N=5000) | reweight the book on a denominator-moving tick, at 5,000 instruments | latency |
| NFR-002 | |Σweights − 1| ≤ 1e-9 on 100% of recomputes | gross-basis recomputes whose weights sum to one within 1e-9 | errors |
| NFR-003 | p99 staleness < 2 ms from originating tick | price tick to the dependent weights reflecting it | latency |