UNPKG

sec-edgar-api

Version:

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

48 lines (47 loc) 1.79 kB
import type { CompanyFactListData, FactGroup, FactItem, FilingListItemTranslated, ReportRaw, SplitData } from '../../types'; import FactFiscalCalculator from './FactFiscalCalculator'; export interface BuildReportsParams { facts: FactItem[]; /** * for more accurate dates, add this. Otherwise, dates will be inferred * using the fact periods. The filing and report dates can be found in the SubmissionList (segEdgarApi.getSubmissions) */ filings?: Pick<FilingListItemTranslated, 'form' | 'reportDate' | 'filingDate' | 'accessionNumber'>[]; /** * Splits will be extracted from facts if not provided. */ splits?: SplitData[]; resolvePeriodValues?: boolean; adjustForSplits?: boolean; /** * For member facts (facts with segments), the separator between the fact name and the segments. */ pathSeparatorForMemberFacts?: string; fiscalYearEnd?: { month: number; day: number; } | null; } /** * Builds ReportRaw objects from company facts. Adjusts for splits and resolves period values. */ export default class ReportRawBuilder { private readonly factRecordBuilder; createFacts(companyFacts: CompanyFactListData, includeNamePrefix?: boolean): { facts: FactItem[]; }; getFactKey(fact: FactItem, pathSeparator: string): string; buildReports(params: BuildReportsParams): ReportRaw[]; private createReportKey; private createReport; private round; buildReportsFromGroups(params: { factGroupsByReportKey: Map<string, FactGroup[]>; fiscalCalculator: FactFiscalCalculator; splits?: SplitData[]; accessionByYearQuarter?: Map<string, string>; minYear: number; maxYear: number; cik: number; }): ReportRaw[]; }