feat(frontend): finish fundamentals reference rails

This commit is contained in:
2026-07-23 10:59:50 +02:00
parent 480baf762f
commit 71d21a45b6
3 changed files with 207 additions and 135 deletions
+27 -23
View File
@@ -109,12 +109,12 @@ reviewed separately if B begins.
share count — both consumers (est. market cap, YoY dilution) want a
point-in-time value. **Nothing
derived is frozen into a row:** discrete quarters (10-Q YTD deltas, Q4 = FY
Q1..Q3), TTM, YoY and the quarter-tape series are all computed **at read time** by
Q1..Q3), TTM, YoY and the four-period metric histories are all computed **at read time** by
picking the newest valid accepted_at snapshot for *each* required period — so
non-calendar fiscal years resolve correctly and a later amendment to a prior
quarter is reflected automatically without ever storing a stale derived quarter.
Readers pick the newest valid accepted_at per period; history powers the UI
quarter tape.
reference comparisons and deterministic reads.
- Keep `fundamental_data` (`app/models/fundamental.py`) as the latest-value compat
cache, repopulated by the daily SEC job — but only after the phase-A5 parity
gate.
@@ -336,37 +336,41 @@ changes.
## UI — `frontend/src/components/ticker/FundamentalsPanel.tsx`
One distinctive visual device — the **quarter tape** — in an otherwise restrained
One distinctive visual device — the **Reference Rails** — in an otherwise restrained
panel. Preserve the app's dark glass styling and numeric typography.
```
Fundamentals Quality improving · valuation rich
Next earnings Aug 3 · AMC Last 4: beat beat miss beat
Fundamentals
Growth accelerating · margins improving · valuation priced above peers
Next earnings Aug 3 · AMC EPS surprises ▂ ▅ ▃ ▆
Quarter tape Q3 Q2 Q1 Latest Read
Revenue growth 8% 11% 15% 18% accelerating
Operating margin 19% 20% 20% 22% improving
FCF margin 12% 10% 14% 16% above own average
Share count change 1.8% dilution
Operating trend less favorable ← ref → more favorable
Revenue growth 18%
───────────────│━━━━● +3pp vs prior · accelerating
Share count YoY 1.7%
───────────────│━━━━● buying back
Balance & valuation
Net debt / EBITDA 1.4× Industry median 2.1× healthy leverage
P/E 29.2× Industry median 23.5× priced above peers
FCF yield 3.8% Industry median 3.1% above peers
Valuation & balance less favorable ← median → more favorable
P/E 29.2×
────●━━━━━━━━━━│──── priced above peers · median 23.5× · 12 peers
```
- Growth, margins, share count: latest four periods as a compact four-cell tape
(or sparkline) plus a deterministic text read (rules below).
- P/E, FCF yield, leverage: horizontal industry-percentile strip with a median
marker. Hidden entirely when `industry` is null (< 5 peer issuers).
- Earnings: four bars around a zero baseline — green beats, red misses, gray
- Growth and margins: horizontal rails compare the latest value with the prior
quarter or prior-period average; share-count YoY compares with zero. The rail
is normalized so right is always more favorable, including buybacks.
- P/E, FCF yield and leverage: horizontal favorable-percentile rails with a
peer-median marker. No decorative rail when `industry` is null (< 5 peers).
- Every row keeps the exact value and one deterministic comparison caption;
missing values render `n/a`, and insufficient peers render `peers n/a`.
- Earnings: four bars around a shared zero baseline — cyan beats, coral misses, gray
unavailable — plus next date and BMO/AMC session countdown.
- Accessibility: color always paired with text or arrows; neutral/ambiguous stays
gray; green/red only when a read is genuinely favorable/adverse.
- Remove the hard-coded "FMP" source label — provenance is per metric.
- Accessibility: color is always paired with text; neutral/ambiguous stays gray;
rails and earnings bars expose complete ARIA descriptions.
- Remove the hard-coded "FMP" source label; surface filing and price-date
provenance in the footer.
**Deterministic reads — one shared rule set.** Implement as a single function with
named constants; the tape reads and the header sentence use identical outputs. No
named constants; the metric reads and the header sentence use identical outputs. No
LLM, no new composite score. Defaults (tunable constants, not scattered literals):
- A series read requires ≥ 3 periods; otherwise show "—" and no read.