Per-tab ratio panel (valuation, profitability, solvency, growth) computed from the latest reported quarter
The ratios endpoint is the canonical home for ratio computation across the stock-analysis surface. The peers package imports ratios.ComputeTab, ratios.Inputs, and the Tab* constants so the comparison table covers the same metric surface.
Every row returns status: insufficient_history under v4.5 — the slot stays in the response shape so adding YoY calculations is a service-only change once multi-quarter history lands.
Always null under v4.5 — explicit nullable so FE renders — vs 0
rows[].unit
string
Display unit; omitted when unitless
rows[].inverted
bool
true = lower is better (P/E, P/B, D/E)
rows[].formula
string
Plain-text formula for tooltip rendering
rows[].sparkline
float[]
Always [] under v4.5; future home for trailing-N quarter history
inverted controls how the peer-comparison BestOf and radar normalization treat the metric. P/E and P/B are inverted so "lower-is-better" still scores higher on the radar.
net_margin is the only ratio that surfaces a valid number when the numerator is negative — a loss carries meaning ("margin = -8%"), and the row gets status: valid with the negative value so FE can colour it red without inferring sign. The other ratios (ROA, ROE, D/E, etc.) collapse to status: negative_input when their numerator/denominator goes non-positive, because the resulting ratio would be misleading.