feat(financials-v2): add statement snapshot schema and shared types
This commit is contained in:
73
lib/types.ts
73
lib/types.ts
@@ -127,6 +127,79 @@ export type CompanyFinancialPoint = {
|
||||
debt: number | null;
|
||||
};
|
||||
|
||||
export type FinancialStatementMode = 'standardized' | 'filing_faithful';
|
||||
export type FinancialStatementKind = 'income' | 'balance' | 'cash_flow' | 'equity' | 'comprehensive_income';
|
||||
export type FinancialHistoryWindow = '10y' | 'all';
|
||||
|
||||
export type FinancialStatementPeriod = {
|
||||
id: string;
|
||||
filingId: number;
|
||||
accessionNumber: string;
|
||||
filingDate: string;
|
||||
periodEnd: string | null;
|
||||
filingType: Extract<Filing['filing_type'], '10-K' | '10-Q'>;
|
||||
periodLabel: string;
|
||||
};
|
||||
|
||||
export type StandardizedStatementRow = {
|
||||
key: string;
|
||||
label: string;
|
||||
concept: string;
|
||||
category: string;
|
||||
sourceConcepts: string[];
|
||||
values: Record<string, number | null>;
|
||||
hasDimensions: boolean;
|
||||
};
|
||||
|
||||
export type FilingFaithfulStatementRow = {
|
||||
key: string;
|
||||
label: string;
|
||||
concept: string | null;
|
||||
order: number;
|
||||
depth: number;
|
||||
isSubtotal: boolean;
|
||||
values: Record<string, number | null>;
|
||||
hasDimensions: boolean;
|
||||
};
|
||||
|
||||
export type DimensionBreakdownRow = {
|
||||
rowKey: string;
|
||||
concept: string | null;
|
||||
periodId: string;
|
||||
axis: string;
|
||||
member: string;
|
||||
value: number | null;
|
||||
unit: string | null;
|
||||
};
|
||||
|
||||
export type CompanyFinancialStatementsResponse = {
|
||||
company: {
|
||||
ticker: string;
|
||||
companyName: string;
|
||||
cik: string | null;
|
||||
};
|
||||
mode: FinancialStatementMode;
|
||||
statement: FinancialStatementKind;
|
||||
window: FinancialHistoryWindow;
|
||||
periods: FinancialStatementPeriod[];
|
||||
rows: StandardizedStatementRow[] | FilingFaithfulStatementRow[];
|
||||
nextCursor: string | null;
|
||||
coverage: {
|
||||
filings: number;
|
||||
rows: number;
|
||||
dimensions: number;
|
||||
};
|
||||
dataSourceStatus: {
|
||||
enabled: boolean;
|
||||
hydratedFilings: number;
|
||||
partialFilings: number;
|
||||
failedFilings: number;
|
||||
pendingFilings: number;
|
||||
queuedSync: boolean;
|
||||
};
|
||||
dimensionBreakdown: Record<string, DimensionBreakdownRow[]> | null;
|
||||
};
|
||||
|
||||
export type CompanyAiReport = {
|
||||
accessionNumber: string;
|
||||
filingDate: string;
|
||||
|
||||
Reference in New Issue
Block a user