Learn R Programming

fdicdata

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))

Copy Link

Version

Install

install.packages('fdicdata')

Monthly Downloads

316

Version

0.1.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Ugur Dar

Last Published

September 12th, 2024

Functions in fdicdata (0.1.1)

getInstitutionsAll

Read FDIC Institution data set
getSummary

Get Summary Data from FDIC API
getFailures

Get information on bank failures from FDIC data
getHistory

Get history of a bank by FDIC certificate number or name
getTaxonomy

Get taxonomy file from FDIC website
idrssd2cert

Convert bank identifier from IDRSSD to CERT
cert2idrssd

Convert bank identifier from CERT to IDRSSD
dataTaxonomy

Taxonomy Data
getFinancials

Get financial data for a given institution
states2URL

Converts a vector of state names to a URL compatible format
getLocation

Get location information for a bank with a given CERT number
getInstitution

Retrieve institution data from FDIC API