Merge pull request 'add financials' (#1) from add-fin into master
Reviewed-on: #1
This commit is contained in:
commit
61f8507a76
@ -30,13 +30,14 @@
|
|||||||
|
|
||||||
**bankfind** is a python interface to publically available bank data from the FDIC.
|
**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:
|
||||||
|
|
||||||
- **failures** - returns detail on failed financial institutions
|
- **failures** - returns detail on failed financial institutions
|
||||||
- **institutions** - returns a list of financial institutions
|
- **institutions** - returns a list of financial institutions
|
||||||
- **history** - returns detail on structure change events
|
- **history** - returns detail on structure change events
|
||||||
- **locations** - returns locations / branches of financial institutions
|
- **locations** - returns locations / branches of financial institutions
|
||||||
- **summary** - returns aggregate financial and structure data, subtotaled by year, regarding financial institutions
|
- **summary** - returns aggregate financial and structure data, subtotaled by year, regarding financial institutions
|
||||||
|
- **financial** - returns financial information for financial institutions
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
@ -4,5 +4,5 @@ __version__ = '0.0.1'
|
|||||||
|
|
||||||
|
|
||||||
from .main import (get_failures, get_history, get_institutions, # noqa
|
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
|
from .metadata import meta_dict # noqa
|
||||||
|
@ -50,6 +50,14 @@ class BF:
|
|||||||
'offset': 0,
|
'offset': 0,
|
||||||
'format': 'json',
|
'format': 'json',
|
||||||
'search': False
|
'search': False
|
||||||
|
},
|
||||||
|
'financials': {
|
||||||
|
'sort_by': 'REPDTE',
|
||||||
|
'sort_order': 'DESC',
|
||||||
|
'limit': 10000,
|
||||||
|
'offset': 0,
|
||||||
|
'format': 'json',
|
||||||
|
'download': False
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +129,7 @@ class BF:
|
|||||||
search: str = None,
|
search: str = None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
params = self._construct_params(key, filters, search, **kwargs)
|
params = self._construct_params(key, filters, search, **kwargs)
|
||||||
|
print(urllib.parse.urlencode(params))
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
f"https://banks.data.fdic.gov/api/{key}",
|
f"https://banks.data.fdic.gov/api/{key}",
|
||||||
params=urllib.parse.urlencode(params)
|
params=urllib.parse.urlencode(params)
|
||||||
|
@ -152,3 +152,44 @@ def get_summary(filters: str = None, **kwargs):
|
|||||||
Return friendly field names
|
Return friendly field names
|
||||||
"""
|
"""
|
||||||
return BF()._get_data("summary", filters, **kwargs)
|
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)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ from .history import history_dict
|
|||||||
from .institution import institution_dict
|
from .institution import institution_dict
|
||||||
from .location import location_dict
|
from .location import location_dict
|
||||||
from .summary import summary_dict
|
from .summary import summary_dict
|
||||||
|
from .financials import financials_dict
|
||||||
|
|
||||||
|
|
||||||
meta_dict = {
|
meta_dict = {
|
||||||
@ -10,5 +11,6 @@ meta_dict = {
|
|||||||
'history': history_dict,
|
'history': history_dict,
|
||||||
'institutions': institution_dict,
|
'institutions': institution_dict,
|
||||||
'locations': location_dict,
|
'locations': location_dict,
|
||||||
'summary': summary_dict
|
'summary': summary_dict,
|
||||||
|
'financials': financials_dict
|
||||||
}
|
}
|
||||||
|
31484
bankfind/metadata/financials.py
Normal file
31484
bankfind/metadata/financials.py
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user