Automate issuer overlay creation from ticker searches

This commit is contained in:
2026-03-19 20:44:58 -04:00
parent 17de3dd72d
commit 391d6d34ce
79 changed files with 4746 additions and 695 deletions

View File

@@ -101,7 +101,7 @@ export function buildDimensionBreakdown(
return map.size > 0 ? Object.fromEntries(map.entries()) : null;
}
export function cloneStandardizedRows(rows: StandardizedFinancialRow[]) {
function cloneStandardizedRows(rows: StandardizedFinancialRow[]) {
return rows.map((row) => ({
...row,
values: { ...row.values },
@@ -116,7 +116,7 @@ export function buildLtmStandardizedRows(
quarterlyRows: StandardizedFinancialRow[],
quarterlyPeriods: FinancialStatementPeriod[],
ltmPeriods: FinancialStatementPeriod[],
statement: Extract<FinancialStatementKind, 'income' | 'balance' | 'cash_flow'>
statement: Extract<FinancialStatementKind, 'income' | 'balance' | 'cash_flow' | 'equity' | 'disclosure'>
) {
const sortedQuarterlyPeriods = [...quarterlyPeriods].sort((left, right) => {
return Date.parse(left.periodEnd ?? left.filingDate) - Date.parse(right.periodEnd ?? right.filingDate);
@@ -141,7 +141,7 @@ export function buildLtmStandardizedRows(
const slice = sortedQuarterlyPeriods.slice(anchorIndex - 3, anchorIndex + 1);
const sourceValues = slice.map((period) => source.values[period.id] ?? null);
row.values[ltmPeriod.id] = statement === 'balance'
row.values[ltmPeriod.id] = statement === 'balance' || statement === 'equity'
? sourceValues[sourceValues.length - 1] ?? null
: sumValues(sourceValues);
row.resolvedSourceRowKeys[ltmPeriod.id] = source.formulaKey ? null : source.resolvedSourceRowKeys[slice[slice.length - 1]?.id ?? ''] ?? null;