UNPKG

sec-edgar-api

Version:

Fetch and parse SEC earnings reports and other filings. Useful for financial analysis.

29 lines (28 loc) 1.04 kB
import type { FactItem, FactGroup, SplitData } from '../../types'; import FactFiscalCalculator from './FactFiscalCalculator'; /** * There are many facts properties for the same period but filed at different times. * This groups those together and resolves the period and trailing values for each group. */ export default class FactGrouper { private preferFirstValue; private createFactGroup; private createGroupKey; private toValue; /** * Map structure { 2022_Q3: { name: ... } }. NOTE: Does not include fiscal year report key. * All groups contain both trailing and period values, so use trailing from Q4 to get FY values. */ buildFactGroupsByReportKey(params: { facts: FactItem[]; splits?: SplitData[]; cik: number; fiscalCalculator: FactFiscalCalculator; resolvePeriodValues: boolean; generateMissingGroups?: boolean; }): { factGroupsByReportKey: Map<string, FactGroup[]>; minYear: number; maxYear: number; }; }