Learn R Programming

edgarfundamentals

Retrieve Fundamental Financial Data from SEC EDGAR

edgarfundamentals provides a simple, ticker-based interface for retrieving key fundamental financial ratios directly from SEC EDGAR 10-K filings. No API key or paid subscription is required.

Installation

# From CRAN (once published)
install.packages("edgarfundamentals")

# Development version
devtools::install_github("robschumaker/edgarfundamentals")

Setup

The SEC requests that automated tools identify themselves via a User-Agent header. Set this once per session:

options(edgarfundamentals.user_agent = "Your Name your@email.com")

Functions

FunctionDescription
get_cik(symbol)Translate a ticker to its SEC Central Index Key
get_fundamentals(symbol, to_date)Key ratios for one stock from its most recent 10-K
get_fundamentals_batch(symbols, to_date)Key ratios for a portfolio of stocks
get_filing_history(symbol, form_type, n)Recent SEC filing history for a stock

Quick Example

library(edgarfundamentals)
options(edgarfundamentals.user_agent = "Jane Smith jane@example.com")

# Single stock
get_fundamentals("LLY", to_date = "2024-12-31")

# Portfolio
healthcare <- c("UNH", "PFE", "MRK", "ABT", "LLY", "CVS", "AMGN")
get_fundamentals_batch(healthcare, to_date = "2024-12-31")

Ratios Returned

get_fundamentals() and get_fundamentals_batch() return the following:

RatioDescriptionSource
EPSDiluted Earnings Per Share (USD)EDGAR
NetIncomeNet Income (USD)EDGAR
RevenueTotal Revenue (USD)EDGAR
ROEReturn on Equity (%)EDGAR
ROAReturn on Assets (%)EDGAR
DEDebt-to-Equity ratioEDGAR
CurrentRatioCurrent Assets / Current LiabilitiesEDGAR
GrossMarginGross Profit as % of RevenueEDGAR
OperatingMarginOperating Income as % of RevenueEDGAR
NetMarginNet Income as % of RevenueEDGAR
PEPrice-to-Earnings ratioEDGAR + Yahoo
PBPrice-to-Book ratioEDGAR + Yahoo
DIVDividend Yield (%)EDGAR + Yahoo

After cloning, generate documentation and check the package before submission:

devtools::document()   # generates man/ files from roxygen2 comments
devtools::check()      # runs R CMD check -- must pass with 0 errors, 0 warnings
devtools::build()      # builds the .tar.gz for CRAN submission

The man/ directory is generated automatically by devtools::document() and is not tracked in version control.

Data Source

All financial statement data comes from the SEC EDGAR XBRL API (data.sec.gov), specifically the companyfacts endpoint. Ratios reflect the most recently completed fiscal year from 10-K filings. PE, PB, and DIV additionally use current market prices from Yahoo Finance via tidyquant.

License

MIT © Robert P Schumaker

Copy Link

Version

Install

install.packages('edgarfundamentals')

Version

0.1.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Robert P Schumaker

Last Published

March 27th, 2026

Functions in edgarfundamentals (0.1.2)

get_fundamentals_batch

Retrieve fundamental financial ratios for a portfolio of stocks
get_filing_history

Retrieve recent SEC filing history for a company
get_fundamentals

Retrieve key fundamental financial ratios for a single stock
get_cik

Look up a company's SEC Central Index Key from its ticker symbol
edgarfundamentals-package

edgarfundamentals: Retrieve Fundamental Financial Data from SEC 'EDGAR'