Title: | Tidy Fundamental Financial Data from 'SEC's 'EDGAR' 'API' |
---|---|
Description: | Streamline the process of accessing fundamental financial data from the United States Securities and Exchange Commission's ('SEC') Electronic Data Gathering, Analysis, and Retrieval system ('EDGAR') 'API' <https://www.sec.gov/edgar/sec-api-documentation>, transforming it into a tidy, analysis-ready format. |
Authors: | Gerard Gimenez-Adsuar [aut, cre] |
Maintainer: | Gerard Gimenez-Adsuar <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.2 |
Built: | 2025-02-09 03:28:59 UTC |
Source: | https://github.com/gerardgimenezadsuar/tidyedgar |
Getting quarterly data from all public companies from EDGAR
get_qdata( account = "Revenues", years = 2020:2023, quarters = c("Q3"), max_cores = TRUE )
get_qdata( account = "Revenues", years = 2020:2023, quarters = c("Q3"), max_cores = TRUE )
account |
A string representing the account (eg NetIncomeLoss, Revenues, OperatingIncomeLoss, ...) |
years |
A sequence of numeric values representing the years. |
quarters |
A string representing the quarter. |
max_cores |
Boolean limiting the number of cores to 1. |
A dataframe
get_qdata(account = "NetIncomeLoss", years = 2022:2023, quarters = c("Q4"))
get_qdata(account = "NetIncomeLoss", years = 2022:2023, quarters = c("Q4"))
Getting yearly data from all public companies from EDGAR
get_ydata(account = "Revenues", years = 2020:2023, ...)
get_ydata(account = "Revenues", years = 2020:2023, ...)
account |
A string representing the account (eg NetIncomeLoss, Revenues, OperatingIncomeLoss, ...) |
years |
A sequence of numeric values representing the years. |
... |
Additional variables to use custom taxonomies or units for data retrieval. |
A dataframe
get_ydata(account = "NetIncomeLoss", years = 2022:2023)
get_ydata(account = "NetIncomeLoss", years = 2022:2023)
Data wrangling for tidy fundamental data from EDGAR
prepare_data(df = NULL, quarterly = TRUE, ...)
prepare_data(df = NULL, quarterly = TRUE, ...)
df |
A dataframe, output from get_qdata() or get_ydata(). |
quarterly |
Boolean indicating if quarterly data is present. |
... |
Additional dataframes to be combined from other accounts (NetIncomeLoss, OperatingIncomeLoss, etc). |
A dataframe
revenue <- data.frame( taxonomy = rep("us-gaap", 3), tag = rep("Revenues", 3), ccp = rep("CY2020", 3), uom = rep("USD", 3), label = rep("Revenues", 3), description = rep("Amount of revenue recognized from goods sold, services rendered, ...", 3), pts = rep(2762, 3), data.accn = c("0001564590-22-012597", "0000002178-23-000038", "0001654954-22-005679"), data.cik = c(2098, 2178, 2186), data.entityName = c("ACME CORP", "ADAMS RESOURCES, INC.", "BK TECHNOLOGIES"), data.loc = c("US-CT", "US-TX", "US-FL"), data.start = rep("2020-01-01", 3), data.end = rep("2020-12-31", 3), data.val = c(164003040, 1022422000, 44139000), year = rep(2020, 3)) netincome <- data.frame( taxonomy = rep("us-gaap", 3), tag = rep("NetIncomeLoss", 3), ccp = rep("CY2020", 3), uom = rep("USD", 3), label = rep("NetIncomeLoss", 3), description = rep("Net Income from operating activities", 3), pts = rep(2762, 3), data.accn = c("0001564590-22-012597", "0000002178-23-000038", "0001654954-22-005679"), data.cik = c(2098, 2178, 2186), data.entityName = c("ACME CORP", "ADAMS RESOURCES, INC.", "BK TECHNOLOGIES"), data.loc = c("US-CT", "US-TX", "US-FL"), data.start = rep("2020-01-01", 3), data.end = rep("2020-12-31", 3), data.val = c(100000, 200000, 4000000), year = rep(2020, 3)) prepare_data(revenue,netincome, quarterly = FALSE)
revenue <- data.frame( taxonomy = rep("us-gaap", 3), tag = rep("Revenues", 3), ccp = rep("CY2020", 3), uom = rep("USD", 3), label = rep("Revenues", 3), description = rep("Amount of revenue recognized from goods sold, services rendered, ...", 3), pts = rep(2762, 3), data.accn = c("0001564590-22-012597", "0000002178-23-000038", "0001654954-22-005679"), data.cik = c(2098, 2178, 2186), data.entityName = c("ACME CORP", "ADAMS RESOURCES, INC.", "BK TECHNOLOGIES"), data.loc = c("US-CT", "US-TX", "US-FL"), data.start = rep("2020-01-01", 3), data.end = rep("2020-12-31", 3), data.val = c(164003040, 1022422000, 44139000), year = rep(2020, 3)) netincome <- data.frame( taxonomy = rep("us-gaap", 3), tag = rep("NetIncomeLoss", 3), ccp = rep("CY2020", 3), uom = rep("USD", 3), label = rep("NetIncomeLoss", 3), description = rep("Net Income from operating activities", 3), pts = rep(2762, 3), data.accn = c("0001564590-22-012597", "0000002178-23-000038", "0001654954-22-005679"), data.cik = c(2098, 2178, 2186), data.entityName = c("ACME CORP", "ADAMS RESOURCES, INC.", "BK TECHNOLOGIES"), data.loc = c("US-CT", "US-TX", "US-FL"), data.start = rep("2020-01-01", 3), data.end = rep("2020-12-31", 3), data.val = c(100000, 200000, 4000000), year = rep(2020, 3)) prepare_data(revenue,netincome, quarterly = FALSE)
Helper function for quarterly financial data retrieval
retrieve_data(account, year, quarter, taxonomy = "us-gaap", unit = "USD")
retrieve_data(account, year, quarter, taxonomy = "us-gaap", unit = "USD")
account |
A string representing the account. |
year |
A numeric value representing the year. |
quarter |
A string representing the quarter. |
taxonomy |
A string representing the taxonomy. |
unit |
A string representing the units. |
A dataframe
Safely calculating the max.
safe_max(x, na.rm = FALSE)
safe_max(x, na.rm = FALSE)
x |
A number. |
na.rm |
Boolean. |
A number.
Getting a summary with the basic financials for all companies
yearly_data(years = 2020:2023)
yearly_data(years = 2020:2023)
years |
A sequence of numeric values representing the years. |
A dataframe
yearly_data(years = 2022:2023)
yearly_data(years = 2022:2023)