sec-edgar-api
Version:
Fetch and parse SEC earnings reports and other filings. Useful for financial analysis.
44 lines (43 loc) • 1.53 kB
TypeScript
import type { CompanyFactListData, FactGroup, FactItem, FactValue, SplitData } from '../../types';
/**
* Splits can be filed multiple times throughout different reports. There is no clear
* indication on when the split is executed or what facts the split has been applied to. This
* class tries to determine which splits have been applied and which need to be adjusted for
* each fact.
*/
export default class FactSplitAdjuster {
private readonly keySplit;
private preferFirstValue;
private getGroupValue;
getSplits(params: {
splitFacts: FactValue[] | FactItem[];
}): SplitData[];
filterSplitFacts(params: {
facts: FactItem[];
}): FactItem[];
extractSplitsFromCompanyFacts(params: {
companyFactList: Pick<CompanyFactListData, 'facts'>;
}): FactValue[];
getSplitsFromCompanyFacts(params: {
companyFactList: Pick<CompanyFactListData, 'facts'>;
}): SplitData[];
/**
* Returns true if the fact value was adjusted, false if it was not,
* and null if the comparison does not match the split
*/
private isAdjustedFromComparedFact;
/**
* Splits can be filed multiple times throughout different reports.
*/
didApplySplit(params: {
isShareRatio: boolean;
split: SplitData;
factGroup: FactGroup;
isTrailing: boolean;
useOppositePeriodFallback?: boolean;
}): boolean;
adjustForSplits(params: {
factGroups: FactGroup[];
splits: SplitData[];
}): void;
}