Expand financials surfaces with ratios, KPIs, and cadence support

- Add bundled financial modeling pipeline (ratios, KPI dimensions/notes, trend series, standardization)
- Introduce company financial bundles storage (Drizzle migration + repo wiring)
- Refactor financials page/API/query flow to use surfaceKind + cadence and new response shapes
This commit is contained in:
2026-03-07 15:16:35 -05:00
parent a42622ba6e
commit db01f207a5
33 changed files with 3589 additions and 1643 deletions

View File

@@ -2,15 +2,15 @@ export const queryKeys = {
companyAnalysis: (ticker: string) => ['analysis', ticker] as const,
companyFinancialStatements: (
ticker: string,
statement: string,
window: string,
surfaceKind: string,
cadence: string,
includeDimensions: boolean,
includeFacts: boolean,
factsCursor: string | null,
factsLimit: number,
cursor: string | null,
limit: number
) => ['financials-v3', ticker, statement, window, includeDimensions ? 'dims' : 'no-dims', includeFacts ? 'facts' : 'rows', factsCursor ?? '', factsLimit, cursor ?? '', limit] as const,
) => ['financials-v3', ticker, surfaceKind, cadence, includeDimensions ? 'dims' : 'no-dims', includeFacts ? 'facts' : 'rows', factsCursor ?? '', factsLimit, cursor ?? '', limit] as const,
filings: (ticker: string | null, limit: number) => ['filings', ticker ?? '', limit] as const,
report: (accessionNumber: string) => ['report', accessionNumber] as const,
watchlist: () => ['watchlist'] as const,

View File

@@ -15,8 +15,8 @@ import {
} from '@/lib/api';
import { queryKeys } from '@/lib/query/keys';
import type {
FinancialHistoryWindow,
FinancialStatementKind
FinancialCadence,
FinancialSurfaceKind
} from '@/lib/types';
export function companyAnalysisQueryOptions(ticker: string) {
@@ -31,8 +31,8 @@ export function companyAnalysisQueryOptions(ticker: string) {
export function companyFinancialStatementsQueryOptions(input: {
ticker: string;
statement: FinancialStatementKind;
window: FinancialHistoryWindow;
surfaceKind: FinancialSurfaceKind;
cadence: FinancialCadence;
includeDimensions?: boolean;
includeFacts?: boolean;
factsCursor?: string | null;
@@ -51,8 +51,8 @@ export function companyFinancialStatementsQueryOptions(input: {
return queryOptions({
queryKey: queryKeys.companyFinancialStatements(
normalizedTicker,
input.statement,
input.window,
input.surfaceKind,
input.cadence,
includeDimensions,
includeFacts,
factsCursor,
@@ -62,8 +62,8 @@ export function companyFinancialStatementsQueryOptions(input: {
),
queryFn: () => getCompanyFinancialStatements({
ticker: normalizedTicker,
statement: input.statement,
window: input.window,
surfaceKind: input.surfaceKind,
cadence: input.cadence,
includeDimensions,
includeFacts,
factsCursor,