Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@

**bankfind** is a python interface to publically available bank data from the FDIC.

There are currently, as of 8/11/20, five endpoints that the FDIC has exposed to the public:
There are currently, as of 4/15/2023, five endpoints that the FDIC has exposed to the public:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
There are currently, as of 4/15/2023, five endpoints that the FDIC has exposed to the public:
There are currently, as of 4/15/2023, six endpoints that the FDIC has exposed to the public:


- **failures** - returns detail on failed financial institutions
- **institutions** - returns a list of financial institutions
- **history** - returns detail on structure change events
- **locations** - returns locations / branches of financial institutions
- **summary** - returns aggregate financial and structure data, subtotaled by year, regarding financial institutions
- **financial** - returns financial information for financial institutions

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion bankfind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@


from .main import (get_failures, get_history, get_institutions, # noqa
get_locations, get_summary)
get_locations, get_summary, get_financials)
from .metadata import meta_dict # noqa
9 changes: 9 additions & 0 deletions bankfind/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ class BF:
'offset': 0,
'format': 'json',
'search': False
},
'financials': {
'sort_by': 'REPDTE',
'sort_order': 'DESC',
'limit': 10000,
'offset': 0,
'format': 'json',
'download': False
}
}

Expand Down Expand Up @@ -121,6 +129,7 @@ def _get_data(
search: str = None,
**kwargs):
params = self._construct_params(key, filters, search, **kwargs)
print(urllib.parse.urlencode(params))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really mean to leave this print statement in here? If this project already has a logging facility it might be best to use that or hide this print statement behind a debug environment variable or something.

r = requests.get(
f"https://banks.data.fdic.gov/api/{key}",
params=urllib.parse.urlencode(params)
Expand Down
41 changes: 41 additions & 0 deletions bankfind/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,44 @@ def get_summary(filters: str = None, **kwargs):
Return friendly field names
"""
return BF()._get_data("summary", filters, **kwargs)

def get_financials(filters: str = None, **kwargs):
"""
Get Financial Information for FDIC Insured Institutions

Arguments
---------
filters: str, default None, optional
Filter for the bank search

Keyword Arguments
-----------------
fields: str, default ALL FIELDS, optional
Comma delimited list of fields to search
sort_by: str, default OFFICES, optional
Field name by which to sort returned data
sort_order: str, default ASC, optional
Indicator if ascending (ASC) or descending (DESC)
limit: int, default 10,000, optional
Number of records to return. Maximum is 10,000
offset: int, default 0, optional
Offset of page to return
agg_by: str, default blank
The field(s) by which data will be aggregated.
agg_term_fields: str, default blank
The field(s) for which aggregations will be counted for each unique term.
agg_sum_fields: str, default blank
The field(s) for which aggregations will be summed or aggregated.
agg_limit: int,
The limit on how many aggregated results will be displayed
format: str, default json, optional
Format of the data to return
download: bool, default False
Whether the data should be downloaded as a file.
filename: str,
The filename to use when downloading data
friendly_fields: bool, default False, optional
Return friendly field names
"""
return BF()._get_data("financials", filters, **kwargs)

4 changes: 3 additions & 1 deletion bankfind/metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
from .institution import institution_dict
from .location import location_dict
from .summary import summary_dict
from .financials import financials_dict


meta_dict = {
'failures': failure_dict,
'history': history_dict,
'institutions': institution_dict,
'locations': location_dict,
'summary': summary_dict
'summary': summary_dict,
'financials': financials_dict
}
Loading