Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sec-edgar-api

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sec-edgar-api

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

  • 0.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-91.3%
Maintainers
0
Weekly downloads
 
Created
Source

SEC Edgar API

Fetch and parse earnings reports and other documents filed with the SEC using the EDGAR API. This package is focused on the earnings reports for stock analysis.

Some main data points available include:

  • Earnings Reports
  • Insider Transactions
  • Institutional Holders
  • Filing History
  • Directors & Executives
  • Executive Compensation

Installation

npm install sec-edgar-api

Report Interface

Reports are all returned as a uniform interface:

interface ReportTranslated {
	cik: number
	url: string | null
	dateReport: string
	dateFiled: string
	fiscalPeriod: FiscalPeriod
	fiscalYear: number
	splitDate: string | null
	splitRatio: number | null

	assetTotal: number | null
	assetCurrent: number | null
	assetCurrentCashEquivalents: number | null
	assetCurrentInvestments: number | null
	assetCurrentAccountsReceivable: number | null
	assetCurrentInventory: number | null

	assetNonCurrent: number | null
	assetNonCurrentPPENet: number | null
	assetNonCurrentPPEGross: number | null
	assetNonCurrentInvestments: number | null
	assetNonCurrentGoodwill: number | null
	assetNonCurrentIntangibleLessGoodwill: number | null

	liabilityTotal: number | null
	liabilityCurrent: number | null
	liabilityCurrentAccountsPayable: number | null
	liabilityCurrentDebt: number | null
	liabilityNonCurrent: number | null
	liabilityNonCurrentDebt: number | null

	equityTotal: number | null
	equityRetainedEarnings: number | null
	equityStockPreferred: number | null

	sharesOutstanding: number | null
	sharesOutstandingDiluted: number | null

	eps: number | null
	epsDiluted: number | null

	ebit: number | null
	ebitda: number | null

	profitGross: number | null

	revenueTotal: number | null
	revenueCost: number | null
	revenueOperating: number | null

	expenseTotal: number | null
	expenseOperating: number | null
	expenseResearchDevelopment: number | null
	expenseInterest: number | null
	expenseDepreciation: number | null
	expenseTax: number | null

	expenseDepreciationAccumulated: number | null
	expenseStockCompensation: number | null
	expenseNonCashOther: number | null

	incomeOperating: number | null
	incomeNet: number | null

	cashFlowFree: number | null
	cashFlowDividendsPaid: number | null
	cashFlowDividendsPaidPreferred: number | null

	cashFlowCapex: number | null
	cashFlowOperating: number | null
	cashFlowDeferredTax: number | null

	cashFlowWorkingCapitalNonCash: number | null
}

Usage

import package contents

import { secEdgarApi } from 'sec-edgar-api'

You can fetch reports individually directly from the SEC website, (throttled to 10 requests per second)

// returns array of ReportWrapper (which implements ReportTranslated)
const reports = await secEdgarApi.getReports({ symbol: 'AAPL' })

Resolvers

The main problem with the edgar API is that the property names and data provided are not uniform. You have to deal with companies omitting important data in some filings, or using different property keys for the same data point.

Resolvers attempt to get information from each report and output a uniform interface. The resolvers will calculate missing data if there is other data that can be used to derive from.

ResolverFormula used to derive values
resolveAssetCurrentassetTotal - assetNonCurrent = assetCurrent
resolveAssetNonCurrentPpeGrossassetNonCurrentPPENet + expenseDepreciationAccumulated = assetNonCurrentPpeGross
resolveCashFlowCapexQ1 + Q2 + Q3 + Q4 = FY (if FY known, divides evenly between missing quarters)
resolveCashFlowFreecashFlowOperating - cashFlowCapex = cashFlowFree
resolveCashFlowOperatingincomeNet + expenseDepreciation - changeInWorkingCapitalNonCash = cashFlowOperating
resolveCashFlowWorkingCapitalNonCash(assetCurrent - assetCurrentCashEquivalents) - (liabilityCurrent - liabilityCurrentDebt) = cashFlowWorkingCapitalNonCash
resolveEbitexpenseDepreciation + ebitda = ebit
resolveExpenseDepreciation(expenseDepreciationFY / assetNonCurrentPpeGrossFY) x assetNonCurrentPpeGross = expenseDepreciation
resolveExpenseOperatingrevenueTotal - incomeOperating - revenueCost = expenseOperating
resolveExpenseTotalrevenueTotal - incomeNet = expenseTotal
resolveFiscalYearCumulativePropertiesQ1 + Q2 + Q3 + Q4 = FY (for quarterly properties that add to annual)
resolveQ4FiscalYearMatchingPropertiesQ4 = FY (for non-cumulative properties such as sharesOutstanding)
resolveRevenueTotalrevenueCost + profitGross = revenueTotal

Contributing

Getting all the properties in a uniform interface accurately is proving to be very difficult due to the differences in all the reports. Please contribute if you know how to improve this.

Files for mapping & resolving properties:

  • Mapping properties: src/util/key-translations.ts
  • Resolving properties: src/services/ReportParser.ts (add resolvers to the resolvers/ directory, import to /resolver/index.ts, and add to ReportParser.resolveAll)

Resources

  • XBRL Taxonomies: https://xbrl.us/xbrl-taxonomy/2024-us-gaap/
  • Validate resolved values: https://finance.yahoo.com/
  • Financial calculations: https://www.gurufocus.com/
  • Calculate change in working capital: https://www.oldschoolvalue.com/stock-valuation/change-in-working-capital/

Keywords

FAQs

Package last updated on 02 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc