Skip to content

Visbanking/fdicdata

Repository files navigation

fdicdata

Lifecycle: stable CRAN status

The fdicdata R package provides a set of functions for working with data from the Federal Deposit Insurance Corporation (FDIC), including retrieving financial data for FDIC-insured institutions and accessing the data taxonomy.

Installation

From CRAN

install.packages("fdicdata")

From GitHub

remotes::install_github("Visbanking/fdicdata",ref="main")

Examples

Taxonomy

dataTaxonomy("financial")

Institutions

# Getting all data
getInstitutionsAll()

# Get data for specific bank (name uses fuzzy match "Iland"~"Island") 
getInstitution(name = "Bank of America", fields = c("NAME", "CITY", "STATE"))

Location

# Get location information for a bank with CERT number 3850
getLocation(3850)

# Get location information for a bank with CERT number 3850 and fields "NAME", "CITY", and "ZIP"
getLocation(3850, fields = c("NAME", "CITY", "ZIP"))
# Getting all location data for a bank.
getLocation(3850 ,fields = dataTaxonomy("location")$Name)

History

getHistory(CERT_or_NAME = 3850, c("INSTNAME","CERT","PCITY","PSTALP","PZIP5"))
getHistory("Iland",fields=c("INSTNAME","CERT","PCITY","PSTALP","PZIP5"),CERT=FALSE)
# Get data for specific bank (CERT_or_NAME uses fuzzy match "Iland"~"Island") 

getHistory(CERT_or_NAME = "JP Morgan", fields =c("INSTNAME","CERT","PCITY","PSTALP","PZIP5"), CERT = FALSE)

Summary

getSummary(c("West Virginia", "Delaware", "Alabama"), c(2015, 2016), c("ASSET", "INTINC"))

Financial

library(fdicdata)
getFinancials(37,"ASSET")
getAllFinancials <- function(IDRSSD_or_CERT,metrics,limit=5){
  all_financials_banks <- data.frame()
  feds <- IDRSSD_or_CERT
  n_feds <- length(feds)
  for (j in 1:n_feds) {
    i <- feds[j]
    message(paste("Processing", i, "(", j, "of", n_feds, ")"))
    retry <- 0
    success <- FALSE
    while (!success && retry < 3) {
      tryCatch({
        suppressWarnings({
          all_financials_single_bank <- getFinancials(i, metrics, limit = limit)
        })
        all_financials_banks <- rbind(all_financials_single_bank, all_financials_banks)
        message(paste(i, "added to data"))
        success <- TRUE
      }, error = function(e) {
        message(paste("API rejected the request, retrying in 3 minutes..."))
        Sys.sleep( sample(1:30, 1))
        retry <<- retry + 1
      })
    }
    if (!success) {
      message(paste("Could not add", i, "to data after 3 tries"))
    }
  }
  return(all_financials_banks)
}
financial_taxonomy <- dataTaxonomy("financial")
# FDIC Bank Find Suite API limits the data user can pull at once
getAllFinancials(c(37,242),financial_taxonomy$Name[1:100])

Failure

getFailures(c("CERT", "NAME", "FAILDATE", "CITY", "STATE"), range = c(2010, 2015))

About

No description, website, or topics provided.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages