Compare commits

..

11 Commits

Author SHA1 Message Date
2e2dd743d2 add docs artifact
All checks were successful
Test bankfind / Python ${{ matrix.python-version }} sample (3.8) (push) Successful in 19s
2024-07-24 07:49:22 -07:00
4aee92547c v3
All checks were successful
Test bankfind / Python ${{ matrix.python-version }} sample (3.8) (push) Successful in 14s
2024-07-24 07:32:37 -07:00
729fd18fbf add artifact upload
Some checks failed
Test bankfind / Python ${{ matrix.python-version }} sample (3.8) (push) Failing after 49s
2024-07-23 08:02:45 -07:00
ce461a52c0 add flit
All checks were successful
Test bankfind / Python ${{ matrix.python-version }} sample (3.8) (push) Successful in 16s
2024-07-23 08:00:50 -07:00
f4575344f0 add mkdocs
All checks were successful
Test bankfind / Python ${{ matrix.python-version }} sample (3.8) (push) Successful in 1m10s
2024-07-23 07:54:31 -07:00
74e2444bd4 fix test
All checks were successful
Test bankfind / Python ${{ matrix.python-version }} sample (3.8) (push) Successful in 39s
2024-07-23 07:49:28 -07:00
3f9c4b6fc5 break a test
Some checks failed
Test bankfind / Python ${{ matrix.python-version }} sample (3.8) (push) Failing after 12s
2024-07-23 07:48:50 -07:00
8b49807361 split tests out
All checks were successful
Test bankfind / Python ${{ matrix.python-version }} sample (3.8) (push) Successful in 12s
2024-07-23 07:44:28 -07:00
d482417504 add tests
All checks were successful
Test bankfind / Python ${{ matrix.python-version }} sample (3.8) (push) Successful in 1m7s
2024-07-23 07:41:20 -07:00
61f8507a76 Merge pull request 'add financials' (#1) from add-fin into master
Reviewed-on: #1
2024-07-22 08:45:10 -07:00
f8ed089fb1 add financials 2024-07-21 19:25:34 -07:00
7 changed files with 31607 additions and 3 deletions

View 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

View File

@ -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
```

View File

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

View File

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

View File

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

View File

@ -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
}

File diff suppressed because it is too large Load Diff