Python client for interfacing with the Federal Reserve Bank's FRED API. Our goal is to provide a simple, well-documented solution for FRED-related programming in Python.
This is a third-party client that is developed and maintained
independently of the Federal Reserve Bank. As such, it is not
affiliated with or supported by the institution.
This client was built to provide users with an intuitive and effective framework for making requests to the FRED API from within Python. As such, our main feature is the ability to interact with the FRED web-service.
Request economic data from all 5 data groups available in FRED and ALFRED. For reference, the data groups are included below. See Federal Reserve Bank of St. Louis for additional documentation, or click on a specific query to go directly to documentation for that query.
- Categories
- fred/category - Get a category.
- fred/category/children - Get the child categories for a specified parent category.
- fred/category/related - Get the related categories for a category.
- fred/category/series - Get the series in a category.
- fred/category/tags - Get the tags for a category.
- fred/category/related_tags - Get the related tags for a category.
- Releases
- fred/releases - Get all releases of economic data.
- fred/releases/dates - Get release dates for all releases of economic data.
- fred/release - Get a release of economic data.
- fred/release/dates - Get release dates for a release of economic data.
- fred/release/series - Get the series on a release of economic data.
- fred/release/sources - Get the sources for a release of economic data.
- fred/release/tags - Get the tags for a release.
- fred/release/related_tags - Get the related tags for a release.
- Series
- fred/series - Get an economic data series.
- fred/series/categories - Get the categories for an economic data series.
- fred/series/observations - Get the observations or data values for an economic data series.
- fred/series/search - Get economic data series that match keywords.
- fred/series/release - Get the release for an economic data series.
- fred/series/search/tags - Get the tags for a series search.
- fred/series/search/related_tags - Get the related tags for a series search.
- fred/series/tags - Get the tags for an economic data series.
- fred/series/updates - Get economic data series sorted by when observations were updated on the FRED server.
- fred/series/vintagedates - Get the dates in history when a series' data values were revised or new data values were released.
- Sources
- fred/sources - Get all sources of economic data.
- fred/source - Get a source of economic data.
- fred/source/releases - Get the releases for a source.
- Tags
- fred/tags - Get all tags, search for tags, or get tags by name.
- fred/related_tags - Get the related tags for one or more tags.
- fred/tags/series - Get the series matching tags.
Transform data from http responses to your preferred format, allowing you to focus more time on data integration and analysis and less on response processing. If you prefer raw responses from FRED, so that you can conduct your own response parsing, simply set response_type
to xml or json (standard FRED responses). Otherwise, automatically transform data into comma, tab, or pipe separated values, python dictionaries, pandas dataframes, or numpy arrays.
For dictionary, dataframe, and array responses, an attempt is made to convert data to more useful dtypes. For example, realtime_start
and realtime_end
response data are automatically converted from a string to datetime64 numpy dtype. Similarly, counts and IDs (where appropriate) are converted to int while observation measures are converted to float.
Install via pip
:
pip install FRB
Git
clone from the command line:
git clone http://github.com/avelkoski/FRB.git
Download directly from Github.
from fred import Fred
fr = Fred(api_key='abcdefghijklmnopqrstuvwxyz123456',response_type='dict')
params = {
'limit':2,
'tag_names':'trade;goods'
}
res = fr.category.series(125,params=params)
for record in res:
print(record)
For additional detail about this package, read our documentation .
The MIT License (MIT)
Copyright (c) 2016 Aleksandar Velkoski avelkoski@realtors.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The author is affiliated with the Data Science division of the National Association of REALTORS®.