add financials #1
@@ -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:
 | 
			
		||||
 | 
			
		||||
- **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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,5 +4,5 @@ __version__ = '0.0.1'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -121,6 +129,7 @@ class BF:
 | 
			
		||||
            search: str = None,
 | 
			
		||||
            **kwargs):
 | 
			
		||||
        params = self._construct_params(key, filters, search, **kwargs)
 | 
			
		||||
        print(urllib.parse.urlencode(params))
 | 
			
		||||
        r = requests.get(
 | 
			
		||||
            f"https://banks.data.fdic.gov/api/{key}",
 | 
			
		||||
            params=urllib.parse.urlencode(params)
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ from .history import history_dict
 | 
			
		||||
from .institution import institution_dict
 | 
			
		||||
from .location import location_dict
 | 
			
		||||
from .summary import summary_dict
 | 
			
		||||
from .financials import financials_dict
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
meta_dict = {
 | 
			
		||||
@@ -10,5 +11,6 @@ meta_dict = {
 | 
			
		||||
    'history': history_dict,
 | 
			
		||||
    'institutions': institution_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
											
										
									
								
							
		Reference in New Issue
	
	Block a user