Compare commits
11 Commits
b9cfe5eae6
...
master
Author | SHA1 | Date | |
---|---|---|---|
2e2dd743d2 | |||
4aee92547c | |||
729fd18fbf | |||
ce461a52c0 | |||
f4575344f0 | |||
74e2444bd4 | |||
3f9c4b6fc5 | |||
8b49807361 | |||
d482417504 | |||
61f8507a76 | |||
f8ed089fb1 |
54
.gitea/workflows/test.yaml
Normal file
54
.gitea/workflows/test.yaml
Normal file
@ -0,0 +1,54 @@
|
||||
name: Test bankfind
|
||||
run-name: ${{ gitea.actor }} is testing out bankfind 🐍
|
||||
on:
|
||||
- push
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ '3.8' ]
|
||||
name: Python ${{ matrix.python-version }} sample
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
architecture: x64
|
||||
- name: Setup Tests and Dependencies
|
||||
run: |
|
||||
python --version
|
||||
pip install -U pip
|
||||
pip install pytest coverage pytest-cov
|
||||
pip install -r requirements.txt
|
||||
- name: Run tests
|
||||
run: |
|
||||
pytest
|
||||
- name: build package with flit
|
||||
run: |
|
||||
pip install -U flit
|
||||
flit build
|
||||
find dist
|
||||
- name: upload package as artifact
|
||||
# v4 doesn't work
|
||||
# uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bankfind
|
||||
path: dist
|
||||
- name: Build docs with mkdocs
|
||||
run: |
|
||||
pip install mkdocs mkdocs-material mkdocs-material-extensions
|
||||
cd docs
|
||||
mkdocs build
|
||||
find site
|
||||
- name: upload docs as artifact
|
||||
# v4 doesn't work
|
||||
# uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bankfind-docs
|
||||
path: docs/site
|
||||
|
16
README.md
16
README.md
@ -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
|
||||
|
||||
@ -69,3 +70,16 @@ data = bf.get_institutions(filters="STNAME:Colorado AND SUBCHAPS:0 AND CB:1")
|
||||
## License
|
||||
|
||||
This project is licensed under the terms of the MIT license.
|
||||
|
||||
## Development
|
||||
|
||||
### Running Tests Locally
|
||||
|
||||
```bash
|
||||
brew install python@3.8
|
||||
mkvirtualenv -p /opt/homebrew/bin/python3.8 bankfind
|
||||
pip install -U pip
|
||||
pip install pytest coverage pytest-cov
|
||||
pip install -r requirements.txt
|
||||
pytest
|
||||
```
|
@ -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