/owning-a-home-api

The API that drives the Owning A Home project.

Primary LanguagePythonCreative Commons Zero v1.0 UniversalCC0-1.0

Owning a Home API Build Status

This provides an API for the Owning a Home project. The tool will return rates available on the market. Note that it relies on bringing data from an external (not free) source.

Status

The API is at version 0.9.6, a work in progress.

Dependencies

Installing and using

The tool is a Django module and can be installed and run inside a Django project. Here's help for setting up a Django project and adding modules:

Install the app (ideally in a virtual environment):

git clone https://github.com/cfpb/owning-a-home-api
cd owning-a-home-api && pip install -e .

In your core Django application, add ratechecker to the INSTALLED_APPS. For example:

INSTALLED_APPS += (
    'rest_framework',
    'countylimits',
    'ratechecker',
    'south',
)

Also add the following urls to your core Django application’s urls.py:

    url(r'^oah-api/rates/', include('ratechecker.urls')),
    url(r'^oah-api/county/', include('countylimits.urls')),

##What the app does

Owning a Home API includes two Django apps:

####ratechecker This app exposes a single API endpoint, /oah-api/rates/rate-checker, with the following parameters:

Param name Required Default value Acceptable values
arm_type No, unless rate_structure=arm N/A 3-1, 5-1, 7-1, 10-1
institution No N/A any valid institution name, for ex. PNC, WELLS, UNBK, etc.
io No 0
loan_amount Yes N/A any positive integer
loan_purpose No PURCH PURCH, REFI
loan_term Yes N/A 30, 15
loan_type Yes N/A JUMBO, CONF, AGENCY, FHA, VA, VA-HB, FHA-HB
lock No 60
ltv *1 No N/A
maxfico Yes N/A 0 -> 850
minfico Yes N/A 0 -> 850
points No 0
price Yes N/A better be larger than loan_amount
property_type No SF
rate_structure Yes N/A FIXED, ARM
state Yes N/A all the US state's abbreviations

[1]: We actually calculate its value and don't check the value sent in request

ratechecker will return a JSON object containing data and timestamp

ratechecker has a management command, load_daily_data, which loads daily interest rate data from CSV.

####countylimits This app exposes a single API endpoint, /oah-api/county, which requires a state parameter for querying Federal Housing Administration loan lending limit, Government-Sponsored Enterprises mortgage loan limit and the Department of Veterans Affairs loan guaranty program limit for the counties in a given state.

Param name Required Default value Acceptable values
state Yes N/A all the US state's abbreviations or fips codes

countylimits will return a JSON object containing state, county, complete_fips, gse_limit, fha_limit, and va_limit.

countylimits has a management command, load_county_limits, which loads these limits from a CSV file provided in data/county_limit_data-flat.csv

Testing

Testing requires mock, so you'll need to install that before running tests.

pip install mock
./manage.py test [ratechecker]

Contributions

We welcome contributions with the understanding that you are contributing to a project that is in the public domain, and anything you contribute to this project will also be released into the public domain. See our CONTRIBUTING file for more details.