fdic


Namefdic JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttp://github.com/aocks/fdic
SummarySimple tools for accessing FDIC public data.
upload_time2023-03-12 20:33:03
maintainerNone
docs_urlNone
authorEmin Martinian
requires_pythonNone
licenseagpl-3.0
keywords fdic bank data tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Introduction
============

This project provides some tools to access data from the FDIC public API
and data resources.

Work in progress; more docs coming soon.

Usage
=====

To try out these tools, install via ``pip install fdic`` or download the
source code from GitHub. Then start a python interpreter and do
something like the following:

First we import various modules and set ftool to be the tool we want:

.. code:: python

   >>> import fdic.query, json
   >>> ftool = fdic.query.FDICTools

Now we can get the institutional data from the FDIC and sort it first by
assets and then by deposits. We print the result in JSON format as a
sanity check and see the largest 3 banks by assets:

.. code:: python

   >>> inst_data = ftool.get_sorted_inst_data()
   >>> top_3_by_assets = inst_data[:3]
   >>> print(json.dumps({i['NAME']: {n: i[n] for n in ['ASSET', 'DEP']}
   ...      for i in top_3_by_assets}, indent=2))
   {
     "JPMorgan Chase Bank, National Association": {
       "ASSET": "3201942000",
       "DEP": "2440722000"
     },
     "Bank of America, National Association": {
       "ASSET": "2418508000",
       "DEP": "2042255000"
     },
     "Citibank, National Association": {
       "ASSET": "1766752000",
       "DEP": "1399631000"
     }
   }

Next we pull in the Uniform Bank Performance Report data. Note that you
will have to download a zip file with this data first. If you don't, you
will get a NeedUBPRZipFile exception telling you how to download the
necessary file.

To save time in parsing, we can provide an rssd\ :sub:`filter` to just
get data for the top 200 banks by assets. After getting the data, we
sort by the UBPRE569 field (unrealized losses as a percent of tier 1
capital for held-to-maturity assets) and then print the data:

.. code:: python

   >>> ubpr_data = ftool.get_ubpr_inst_data(rssd_filter={
   ...     i['FED_RSSD'] for i in inst_data[:50]})
   >>> htm_data = list(sorted(ubpr_data, key=lambda i: i['UBPRE569']))
   >>> print(json.dumps({i['NAME']: {n: i[n] for n in ['NAME', 'UBPRE569']}
   ...      for i in htm_data[:3]}, indent=2))
   {
     "Silicon Valley Bank": {
       "NAME": "Silicon Valley Bank",
       "UBPRE569": -89.2
     },
     "Bank of America, National Association": {
       "NAME": "Bank of America, National Association",
       "UBPRE569": -59.95
     },
     "Charles Schwab Bank, SSB": {
       "NAME": "Charles Schwab Bank, SSB",
       "UBPRE569": -46.87
     }
   }

You can find a list of the UBPR codes at the `Federal
Reserve <https://www.federalreserve.gov/apps/mdrm/data-dictionary/search/series?sid=1388&show_short_title=False&show_conf=False&rep_status=All&rep_state=Opened&rep_period=Before&date_start=20160912&date_end=20160912>`__.
For example if you are interested in both ``UBPRE569`` (unrealized
losses on the held-to-maturity portfolio as percent of tier 1 capital)
as well as ``UBPRM037`` (appreciation in available for sale securities /
percent of available for sale securities), you could do something like
the following:

.. code:: python

   >>> codes = {
   ...    'UBPRE569': {'convert': float},
   ...    'UBPRM037': {'convert': float},
   ... }
   >>> ubpr_data = ftool.get_ubpr_inst_data(rssd_filter={
   ...     i['FED_RSSD'] for i in inst_data[:50]}, codes=codes)
   >>> htm_data = list(sorted(ubpr_data, key=lambda i: i['UBPRE569']))
   >>> print(json.dumps({i['NAME']: {n: i[n] for n in (['NAME']+list(codes))}
   ...      for i in htm_data[:3]}, indent=2))
   {
     "Silicon Valley Bank": {
       "NAME": "Silicon Valley Bank",
       "UBPRE569": -89.2,
       "UBPRM037": -8.86
     },
     "Bank of America, National Association": {
       "NAME": "Bank of America, National Association",
       "UBPRE569": -59.95,
       "UBPRM037": -2.0
     },
     "Charles Schwab Bank, SSB": {
       "NAME": "Charles Schwab Bank, SSB",
       "UBPRE569": -46.87,
       "UBPRM037": -8.17
     }
   }


            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/aocks/fdic",
    "name": "fdic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "fdic bank data tools",
    "author": "Emin Martinian",
    "author_email": "emin.martinian@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ec/39/2c3b281f1cc6f977908b99e4dc299be77644b432045288f6e932920c251a/fdic-0.1.3.tar.gz",
    "platform": null,
    "description": "Introduction\n============\n\nThis project provides some tools to access data from the FDIC public API\nand data resources.\n\nWork in progress; more docs coming soon.\n\nUsage\n=====\n\nTo try out these tools, install via ``pip install fdic`` or download the\nsource code from GitHub. Then start a python interpreter and do\nsomething like the following:\n\nFirst we import various modules and set ftool to be the tool we want:\n\n.. code:: python\n\n   >>> import fdic.query, json\n   >>> ftool = fdic.query.FDICTools\n\nNow we can get the institutional data from the FDIC and sort it first by\nassets and then by deposits. We print the result in JSON format as a\nsanity check and see the largest 3 banks by assets:\n\n.. code:: python\n\n   >>> inst_data = ftool.get_sorted_inst_data()\n   >>> top_3_by_assets = inst_data[:3]\n   >>> print(json.dumps({i['NAME']: {n: i[n] for n in ['ASSET', 'DEP']}\n   ...      for i in top_3_by_assets}, indent=2))\n   {\n     \"JPMorgan Chase Bank, National Association\": {\n       \"ASSET\": \"3201942000\",\n       \"DEP\": \"2440722000\"\n     },\n     \"Bank of America, National Association\": {\n       \"ASSET\": \"2418508000\",\n       \"DEP\": \"2042255000\"\n     },\n     \"Citibank, National Association\": {\n       \"ASSET\": \"1766752000\",\n       \"DEP\": \"1399631000\"\n     }\n   }\n\nNext we pull in the Uniform Bank Performance Report data. Note that you\nwill have to download a zip file with this data first. If you don't, you\nwill get a NeedUBPRZipFile exception telling you how to download the\nnecessary file.\n\nTo save time in parsing, we can provide an rssd\\ :sub:`filter` to just\nget data for the top 200 banks by assets. After getting the data, we\nsort by the UBPRE569 field (unrealized losses as a percent of tier 1\ncapital for held-to-maturity assets) and then print the data:\n\n.. code:: python\n\n   >>> ubpr_data = ftool.get_ubpr_inst_data(rssd_filter={\n   ...     i['FED_RSSD'] for i in inst_data[:50]})\n   >>> htm_data = list(sorted(ubpr_data, key=lambda i: i['UBPRE569']))\n   >>> print(json.dumps({i['NAME']: {n: i[n] for n in ['NAME', 'UBPRE569']}\n   ...      for i in htm_data[:3]}, indent=2))\n   {\n     \"Silicon Valley Bank\": {\n       \"NAME\": \"Silicon Valley Bank\",\n       \"UBPRE569\": -89.2\n     },\n     \"Bank of America, National Association\": {\n       \"NAME\": \"Bank of America, National Association\",\n       \"UBPRE569\": -59.95\n     },\n     \"Charles Schwab Bank, SSB\": {\n       \"NAME\": \"Charles Schwab Bank, SSB\",\n       \"UBPRE569\": -46.87\n     }\n   }\n\nYou can find a list of the UBPR codes at the `Federal\nReserve <https://www.federalreserve.gov/apps/mdrm/data-dictionary/search/series?sid=1388&show_short_title=False&show_conf=False&rep_status=All&rep_state=Opened&rep_period=Before&date_start=20160912&date_end=20160912>`__.\nFor example if you are interested in both ``UBPRE569`` (unrealized\nlosses on the held-to-maturity portfolio as percent of tier 1 capital)\nas well as ``UBPRM037`` (appreciation in available for sale securities /\npercent of available for sale securities), you could do something like\nthe following:\n\n.. code:: python\n\n   >>> codes = {\n   ...    'UBPRE569': {'convert': float},\n   ...    'UBPRM037': {'convert': float},\n   ... }\n   >>> ubpr_data = ftool.get_ubpr_inst_data(rssd_filter={\n   ...     i['FED_RSSD'] for i in inst_data[:50]}, codes=codes)\n   >>> htm_data = list(sorted(ubpr_data, key=lambda i: i['UBPRE569']))\n   >>> print(json.dumps({i['NAME']: {n: i[n] for n in (['NAME']+list(codes))}\n   ...      for i in htm_data[:3]}, indent=2))\n   {\n     \"Silicon Valley Bank\": {\n       \"NAME\": \"Silicon Valley Bank\",\n       \"UBPRE569\": -89.2,\n       \"UBPRM037\": -8.86\n     },\n     \"Bank of America, National Association\": {\n       \"NAME\": \"Bank of America, National Association\",\n       \"UBPRE569\": -59.95,\n       \"UBPRM037\": -2.0\n     },\n     \"Charles Schwab Bank, SSB\": {\n       \"NAME\": \"Charles Schwab Bank, SSB\",\n       \"UBPRE569\": -46.87,\n       \"UBPRM037\": -8.17\n     }\n   }\n\n",
    "bugtrack_url": null,
    "license": "agpl-3.0",
    "summary": "Simple tools for accessing FDIC public data.",
    "version": "0.1.3",
    "split_keywords": [
        "fdic",
        "bank",
        "data",
        "tools"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec392c3b281f1cc6f977908b99e4dc299be77644b432045288f6e932920c251a",
                "md5": "4a11e7127e74edc51a9384ba1a376eb2",
                "sha256": "f390c04b22112a1e64198bac5a49e25527ca861f28a7973d831162889b98f6e6"
            },
            "downloads": -1,
            "filename": "fdic-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4a11e7127e74edc51a9384ba1a376eb2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6712,
            "upload_time": "2023-03-12T20:33:03",
            "upload_time_iso_8601": "2023-03-12T20:33:03.016411Z",
            "url": "https://files.pythonhosted.org/packages/ec/39/2c3b281f1cc6f977908b99e4dc299be77644b432045288f6e932920c251a/fdic-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-12 20:33:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "aocks",
    "github_project": "fdic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "fdic"
}
        
Elapsed time: 1.02904s