Federal Reserve Economic Data (FRED) Client¶
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.
For other ways to interface with FRED in Python, see mortada/fredapi or zachwill/fred .
Note
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.
Compatibility¶
The Federal Reserve Bank does not provide a versioned API. We constantly monitor the API to ensure that our client is compatible with FRED. If you notice a compatibility issue, please let use know and we’ll work to resolve the issue.
Basic usage¶
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)
Features¶
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.
Comprehensive query support¶
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.
Popular response transformations¶
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.
FRED vs. ALFRED¶
FRED stands for Federal Reserve Economic Data. FRED contains frequently updated US macro and regional economic time series at annual, quarterly, monthly, weekly, and daily frequencies.
ALFRED stands for Archival Federal Reserve Economic Data. ALFRED archives FRED data by adding the real-time period when values were originally released and later revised.
FRED and ALFRED use the same web-service. As noted in the Federal Reserve Bank documentation,
most users are interested in FRED. As such, default parameters have been selected by the bank
to cater to FRED users. If you want to access ALFRED for a given period, simply provide
the real-time period by passing the relevant realtime_start
and realtime_end
parameters to the function handling your request.
Contents¶
Quickstart Guide¶
If you’re new to the Federal Reserve Economic Data (FRED) API, or if you’re new to using our client, this guide should provide you with all you need to know to start requesting economic data.
Installation¶
Install via pip
:
pip install FRB
Git
clone from the command line:
git clone http://github.com/avelkoski/FRB.git
Download directly from Github.
Configuration¶
Default parameters can be set within fred/config.py
or optionally when you instantiate Fred()
. These include
api_key
and response_type
. In order to request data from FRED,
you must configure the client with your api_key
.
Note
Economic data are revised from time-to-time. A real-time period marks
when information was known to be true. In FRED, the real-time period
defaults to the current date (e.g. the parameters realtime_start
and realtime_end
, which define the real-time period, are set to today’s date).
Data are interpreted as facts known to be true as of today (most recent figure or revision).
The real-time period can be set as an optional parameter in most functions. See our
discussion FRED vs. ALFRED for additional details.
Usage¶
Instantiate FRED with your API key and preferred response format:
from fred import Fred
fr = Fred(api_key='abcdefghijklmnopqrstuvwxyz123456',response_type='df')
If you do not include response_type
, the default response is xml
.
Available response types include xml
, json
, dict
, df
, numpy
, csv
,
tab
, and pipe
.
Categories¶
Economic data categories represent classes of data series that are regarded as having similar characteristics. Categories are often made up of subcategories along with economic data series.
Details¶
To request category details, provide a category ID to the details method of the category client:
res = fr.category.details(1)
print res
The response includes the category ID, name, and parent category ID associated with the requested category. The parent category ID is 0 if the category has no parents.
id | name | parent_id |
---|---|---|
1 | Production & Business Activity | 0 |
Children¶
Get the child categories for a specified parent category.
res = fr.category.children(1)
print res
The response includes the category ID, name, and parent category ID associated with a given child category. The parent category ID is 1 because we requested its children.
id | name | parent_id |
---|---|---|
32262 | Business Cycle Expansions & Contractions | 1 |
32436 | Construction | 1 |
33490 | Finance Companies | 1 |
32216 | Health Insurance | 1 |
97 | Housing | 1 |
3 | Industrial Production & Capacity Utilization | 1 |
32295 | Institute for Supply Management Report on Busi... | 1 |
32429 | Manufacturing | 1 |
6 | Retail Trade | 1 |
33441 | Services | 1 |
33492 | Technology | 1 |
33202 | Transportation | 1 |
33203 | Wholesale Trade | 1 |
Series¶
Get economic data series associated with a category. In this request, we add optional parameters to help refine our response. We limit the number of records to 5, request series with the tags trade and goods, order the response by popularity (descending):
params = {
'limit':5,
'tag_names':'trade;goods',
'order_by':'popularity',
'sort_order':'desc'
}
res = fr.category.series(125,params=params)
print res
The response includes the series frequency, observation period, and popularity, among other descriptive features.
frequency | frequency_short | id | last_updated | observation_end | observation_start | popularity | realtime_end | realtime_start | seasonal_adjustment | seasonal_adjustment_short | title | units | units_short |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Monthly | M | BOPGSTB | Timestamp(‘2016-01-07 16:46:02’) | Timestamp(‘2015-11-01 00:00:00’) | Timestamp(‘1992-01-01 00:00:00’) | 61 | Timestamp(‘2016-01-09 00:00:00’) | Timestamp(‘2016-01-09 00:00:00’) | Seasonally Adjusted | SA | Trade Balance: Goods, and Services Balance of Payments Basis | Millions of Dollars | Mil. of $ |
Monthly | M | BOPGTB | Timestamp(‘2016-01-07 16:46:02’) | Timestamp(‘2015-11-01 00:00:00’) | Timestamp(‘1992-01-01 00:00:00’) | 42 | Timestamp(‘2016-01-09 00:00:00’) | Timestamp(‘2016-01-09 00:00:00’) | Seasonally Adjusted | SA | Trade Balance: Goods, Balance of Payments Basis | Millions of Dollars | Mil. of $ |
Tags¶
Get the FRED tags associated with a category.
params = {
'limit':10
}
res = fr.category.tags(125,params=params)
print res
The response includes the tag group_id, name, and series_count associated with a given category tag.
created | group_id | name | notes | popularity | series_count |
---|---|---|---|---|---|
2012-02-27 16:18:19 | src | bea | US. Bureau of Economic Analysis | 86 | 45 |
2012-02-27 16:18:19 | geot | nation | Country Level | 100 | 45 |
2012-02-27 16:18:19 | geo | usa | United States of America | 100 | 45 |
2012-02-27 16:18:19 | gen | balance | 63 | 39 | |
2012-02-27 16:18:19 | seas | nsa | Not seasonally adjusted | 97 | 28 |
2012-02-27 16:18:19 | freq | quarterly | 88 | 28 | |
2012-02-27 16:18:19 | gen | discontinued | 69 | 21 | |
2012-02-27 16:18:19 | seas | sa | Seasonally adjusted | 93 | 17 |
2012-02-27 16:18:19 | freq | annual | 84 | 14 | |
2012-02-27 16:18:19 | gen | services | 71 | 14 |
Releases¶
A release is a distribution of an economic data series. Releases are often maintained by different parties, including the Federal Reserve Bank, Bureau of Labor Statistics, Bureau of Economic Analysis, and Census Bureau.
All releases¶
Get all releases of economic data.
params = {
'limit':5,
}
res = fr.release.all_releases(params=params)
print res
The response includes the release ID, name, and link (among other items) associated with the requested release.
id | link | name | press_release | realtime_end | realtime_start |
---|---|---|---|---|---|
9 | http://www.census.gov/retail/ | Advance Monthly Sales for Retail and Food Serv... | True | 2016-01-09 | 2016-01-09 |
10 | http://www.bls.gov/cpi/ | Consumer Price Index | True | 2016-01-09 | 2016-01-09 |
11 | http://www.bls.gov/ncs/ect/ | Employment Cost Index | True | 2016-01-09 | 2016-01-09 |
13 | http://www.federalreserve.gov/releases/g17/ | G.17 Industrial Production and Capacity Utiliz... | True | 2016-01-09 | 2016-01-09 |
14 | http://www.federalreserve.gov/releases/g19/ | G.19 Consumer Credit | True | 2016-01-09 | 2016-01-09 |
All dates¶
Get release dates for all releases of economic data.
params = {
'limit':5,
}
res = fr.release.all_dates(params=params)
print res
The response includes the date, release ID, name of the release:
date | release_id | release_name |
---|---|---|
2016-01-08 | 302 | Cleveland Financial Stress Index |
2016-01-08 | 86 | Commercial Paper |
2016-01-08 | 72 | Daily Treasury Inflation-Indexed Securities |
2016-01-08 | 279 | Economic Policy Uncertainty |
2016-01-08 | 50 | Employment Situation |
Details¶
To request release details, provide a release ID to the details method of the release client:
res = fr.release.details(51)
print res
The response includes the release ID, name, and link (among other items) associated with the requested release.
id | link | name | press_release | realtime_end | realtime_start |
---|---|---|---|---|---|
51 | http://www.bea.gov/newsreleases/international/... | U.S. International Trade in Goods and Services | True | 2016-01-09 | 2016-01-09 |
Dates¶
Get release dates for a release of economic data:
params = {
'limit':5,
}
res = fr.release.dates(51,params=params)
print res
The response includes the date of the release and the realease_id.
date | release_id |
---|---|
1997-01-17 | 51 |
1997-02-19 | 51 |
1997-03-20 | 51 |
1997-04-17 | 51 |
1997-04-25 | 51 |
Series¶
Get the series on a release of economic data:
params = {
'limit':2,
}
res = fr.release.series(51,params=params)
print res
The response includes the series frequency, observation period, and popularity, among other descriptive features.
frequency | frequency_short | id | last_updated | notes | observation_end | observation_start | popularity | realtime_end | realtime_start | seasonal_adjustment | seasonal_adjustment_short | title | units | units_short |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Monthly | M | BOMTVLM133S | Timestamp(‘2016-01-07 16:46:01’) | NaN | Timestamp(‘2015-11-01 00:00:00’) | Timestamp(‘1992-01-01 00:00:00’) | 0 | Timestamp(‘2016-01-10 00:00:00’) | Timestamp(‘2016-01-10 00:00:00’) | Seasonally Adjusted | SA | U.S. Imports of Services - Travel | Million of Dollars | Mil. of $ |
Monthly | M | BOMVGMM133S | Timestamp(‘2014-10-20 14:27:37’) | BEA has introduced new table presentations, including a new presentation of services, as part of a comprehensive restructuring of BEAu2019s international economic accounts.For more information see http://www.bea.gov/international/revision-2014.htm. | Timestamp(‘2013-12-01 00:00:00’) | Timestamp(‘1992-01-01 00:00:00’) | 7 | Timestamp(‘2016-01-10 00:00:00’) | Timestamp(‘2016-01-10 00:00:00’) | Seasonally Adjusted | SA | U.S. Imports of Services: U.S. Government Miscellaneous Services (DISCONTINUED) | Millions of Dollars | Mil. of $ |
Tags¶
Get the FRED tags associated with a release.
params = {
'limit':10
}
res = fr.release.tags(51,params=params)
print res
The response includes the tag group_id, name, and series_count associated with a given release tag.
created | group_id | name | notes | popularity | series_count |
---|---|---|---|---|---|
2012-02-27 16:18:19 | src | bea | US. Bureau of Economic Analysis | 86 | 57 |
2012-02-27 16:18:19 | src | census | US. Bureau of the Census | 79 | 57 |
2012-02-27 16:18:19 | freq | monthly | 94 | 57 | |
2012-02-27 16:18:19 | geot | nation | Country Level | 100 | 57 |
2012-02-27 16:18:19 | geo | usa | United States of America | 100 | 57 |
2012-02-27 16:18:19 | seas | sa | Seasonally adjusted | 93 | 41 |
2012-02-27 16:18:19 | gen | services | 71 | 38 | |
2012-02-27 16:18:19 | gen | exports | 63 | 27 | |
2012-02-27 16:18:19 | gen | imports | 61 | 27 | |
2012-02-27 16:18:19 | gen | goods | 71 | 24 |
Related tags¶
Get the related FRED tags for one or more FRED tags within a release.
params = {
'tag_group_id':'gen',
'limit':10,
'exclude_tag_names':'services',
'sort_order':'asc'
}
res = fr.release.related_tags(51,tag_names='bea',params=params)
print res
The response includes the tag group_id, name, and series_count associated with a given release tag.
created | group_id | name | notes | popularity | series_count |
---|---|---|---|---|---|
2012-02-27 16:18:19 | gen | balance | 63 | 1 | |
2012-02-27 16:18:19 | gen | trade | 59 | 1 | |
2013-01-28 20:10:13 | gen | bop | Balance of Payments | 56 | 3 |
2012-02-27 16:18:19 | gen | exports | 63 | 9 | |
2012-02-27 16:18:19 | gen | imports | 61 | 9 | |
2012-02-27 16:18:19 | gen | goods | 71 | 19 |
Series¶
Economic data series are quantitative measures used to describe various components of the economy. Series consist of data measured over a time interval.
Details¶
To request series details, provide a series ID to the details method of the series client:
res = fr.series.details('GNPCA')
print res
The response includes the series frequency, observation period, and popularity, among other descriptive features.
frequency | frequency_short | id | last_updated | notes | observation_end | observation_start | popularity | realtime_end | realtime_start | seasonal_adjustment | seasonal_adjustment_short | title | units | units_short |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Annual | A | GNPCA | Timestamp(‘2015-07-30 14:03:15’) | BEA Account Code: A001RX1 | Timestamp(‘2014-01-01 00:00:00’) | Timestamp(‘1929-01-01 00:00:00’) | 28 | Timestamp(‘2016-01-10 00:00:00’) | Timestamp(‘2016-01-10 00:00:00’) | Not Seasonally Adjusted | NSA | Real Gross National Product | Billions of Chained 2009 Dollars | Bil. of Chn. 2009 $ |
Categories¶
Get the categories for an economic data series:
res = fr.series.categories('GNPCA')
print res
The response includes category ID, name, and parent ID:
id | name | parent_id |
---|---|---|
106 | GDP/GNP | 18 |
Release¶
Get the release for an economic data series:
res = fr.series.release('GNPCA')
print res
The response includes the release ID, name, and a link to the release:
id | link | name | press_release | realtime_end | realtime_start |
---|---|---|---|---|---|
53 | http://www.bea.gov/national/index.htm | Gross Domestic Product | True | Timestamp(‘2016-01-10 00:00:00’) | Timestamp(‘2016-01-10 00:00:00’) |
Observations¶
Get the observations or data values for an economic data series:
params = {
'limit':5,
'output_type':1
}
res = fr.series.observations('GNPCA',params=params)
print res
The response includes the date, real-time period, and value of the observation:
date | realtime_end | realtime_start | value |
---|---|---|---|
1929-01-01 | 2016-01-10 | 2016-01-10 | 1066.8 |
1930-01-01 | 2016-01-10 | 2016-01-10 | 976.3 |
1931-01-01 | 2016-01-10 | 2016-01-10 | 912.9 |
1932-01-01 | 2016-01-10 | 2016-01-10 | 794.8 |
1933-01-01 | 2016-01-10 | 2016-01-10 | 784.0 |
Tags¶
Get the tags for an economic data series:
res = fr.series.tags('GNPCA')
print res
The response includes the tag group_id, name, and series_count associated with a given series search.
created | group_id | name | notes | popularity | series_count |
---|---|---|---|---|---|
2012-02-27 16:18:19 | seas | nsa | Not seasonally adjusted | 97 | 326950 |
2012-02-27 16:18:19 | geo | usa | United States of America | 100 | 248427 |
2012-02-27 16:18:19 | freq | annual | 84 | 222080 | |
2012-02-27 16:18:19 | geot | nation | Country Level | 100 | 163584 |
2012-02-27 16:18:19 | src | bea | US. Bureau of Economic Analysis | 86 | 22902 |
2012-08-16 20:21:17 | rls | nipa | National Income and Product Accounts | 83 | 11765 |
2012-02-27 16:18:19 | gen | real | Inflation Adjusted Data | 82 | 9282 |
2012-02-27 16:18:19 | gen | gnp | Gross National Product | 57 | 437 |
Updates¶
Get economic data series sorted by when observations were updated on the FRED server:
params = {
'limit':2,
}
res = fr.series.updates('GNPCA',params=params)
print res
The response includes the tag group_id, name, and series_count associated with a given series search.
frequency | frequency_short | id | last_updated | notes | observation_end | observation_start | popularity | realtime_end | realtime_start | seasonal_adjustment | seasonal_adjustment_short | title | units | units_short |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Daily | D | RUTOP200TR | 2016-01-09 01:56:42 | The Russell Top 200® Index measures the performance of the largest cap segment of the U.S. equity universe. The Russell Top 200® Index is a subset of the Russell 3000® Index. It includes approximately 200 of the largest securities based on a combination of their market cap and current index membership and represents approximately 68% of the U.S. market. The Russell Top 200® Index is constructed to provide a comprehensive and unbiased barometer for this very large cap segment and is completely reconstituted annually to ensure new and growing equities are reflected.
|
2016-01-08 00:00:00 | 1978-12-31 00:00:00 | 23 | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | Not Seasonally Adjusted | NSA | Russell Top 200® Total Market Index | Index | Index |
Daily | D | RUTOP200PR | 2016-01-09 01:56:41 | The Russell Top 200® Index measures the performance of the largest cap segment of the U.S. equity universe. The Russell Top 200® Index is a subset of the Russell 3000® Index. It includes approximately 200 of the largest securities based on a combination of their market cap and current index membership and represents approximately 68% of the U.S. market. The Russell Top 200® Index is constructed to provide a comprehensive and unbiased barometer for this very large cap segment and is completely reconstituted annually to ensure new and growing equities are reflected.
|
2016-01-08 00:00:00 | 1978-12-31 00:00:00 | 16 | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | Not Seasonally Adjusted | NSA | Russell Top 200® Price Index | Index | Index |
Vintage dates¶
Get the dates in history when a series’ data values were revised or new data values were released:
params = {
'limit':10,
'sort_order':'desc'
}
res = fr.series.vintage_dates('GNPCA',params=params)
print res
The response includes vintage_dates:
0 |
---|
2015-07-30 |
2015-03-27 |
2014-07-30 |
2014-03-27 |
2013-07-31 |
2013-03-28 |
2012-07-27 |
2012-03-29 |
2011-07-29 |
2011-03-25 |
Search¶
Get economic data series that match keywords:
params = {
'limit':2,
}
res = fr.series.search('money service index',params=params)
print res
The response includes the series frequency, observation period, and popularity, among other descriptive features.
frequency | frequency_short | id | last_updated | notes | observation_end | observation_start | popularity | realtime_end | realtime_start | seasonal_adjustment | seasonal_adjustment_short | title | units | units_short |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Monthly | M | MSIM1P | Timestamp(‘2014-01-17 13:16:45’) | The MSI measure the flow of monetary services received each period by households and firms from their holdings of monetary assets (levels of the indexes are sometimes referred to as Divisia monetary aggregates). | Timestamp(‘2013-12-01 00:00:00’) | Timestamp(‘1967-01-01 00:00:00’) | 30 | Timestamp(‘2016-01-10 00:00:00’) | Timestamp(‘2016-01-10 00:00:00’) | Seasonally Adjusted | SA | Monetary Services Index: M1 (preferred) | Billions of Dollars | Bil. of $ |
Monthly | M | MSIMZMP | Timestamp(‘2014-01-17 13:16:42’) | The MSI measure the flow of monetary services received each period by households and firms from their holdings of monetary assets (levels of the indexes are sometimes referred to as Divisia monetary aggregates).rnPreferred benchmark rate equals 100 basis points plus the largest rate in the set of rates. rnAlternative benchmark rate equals the larger of the preferred benchmark rate and the Baa corporate bond yield. | Timestamp(‘2013-12-01 00:00:00’) | Timestamp(‘1967-01-01 00:00:00’) | 24 | Timestamp(‘2016-01-10 00:00:00’) | Timestamp(‘2016-01-10 00:00:00’) | Seasonally Adjusted | SA | Monetary Services Index: MZM (preferred) | Billions of Dollars | Bil. of $ |
Search tags¶
Get the tags for a series search:
params = {
'limit':5
}
res = fr.series.search_tags('money service index',params=params)
print res
The response includes the tag group_id, name, and series_count associated with a given series search.
created | group_id | name | notes | popularity | series_count |
---|---|---|---|---|---|
2012-08-29 15:22:19 | gen | academic data | Time series data created mainly by academia to address growing demand in understanding specific concerns in the economy that are not well modeled by ordinary statistical agencies. | 62 | 25 |
2013-06-21 15:22:49 | src | anderson & jones | Richard Anderson and Barry Jones | 35 | 25 |
2014-11-17 19:34:12 | src | anderson, richard g. | 37 | 25 | |
2012-02-27 16:18:19 | gen | divisia | Monetary Services Indexes | 35 | 25 |
2012-02-27 16:18:19 | src | frb stl | Federal Reserve Bank of St. Louis (source) | 83 | 25 |
Search releated tags¶
Get the related tags for a series search:
params = {
'limit':5,
'order_by':'popularity',
'sort_order':'desc'
}
res = fr.series.search_related_tags('mortgage rate','30-year;frb',params=params)
The response includes the tag group_id, name, and series_count associated with a given series search.
created | group_id | name | notes | popularity | series_count |
---|---|---|---|---|---|
2012-02-27 16:18:19 | geot | nation | Country Level | 100 | 3 |
2012-02-27 16:18:19 | geo | usa | United States of America | 100 | 3 |
2012-02-27 16:18:19 | seas | nsa | Not seasonally adjusted | 97 | 3 |
2012-02-27 16:18:19 | freq | monthly | 94 | 1 | |
2012-05-29 15:14:19 | gen | interest rate | 91 | 3 |
Sources¶
Economic data series derive from a variety of sources,including the Federal Reserve Bank, Bureau of Labor Statistics,Bureau of Economic Analysis, and Census Bureau.
All sources¶
Get all sources:
params = {
'limit':10
}
res = fr.source.sources(params=params)
print res
The response includes source ID, name, and link to the source:
id | link | name | realtime_end | realtime_start |
---|---|---|---|---|
1 | http://www.federalreserve.gov/ | Board of Governors of the Federal Reserve System (US) | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
3 | http://www.philadelphiafed.org/ | Federal Reserve Bank of Philadelphia | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
4 | http://www.stlouisfed.org/ | Federal Reserve Bank of St. Louis | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
6 | http://www.ffiec.gov/ | Federal Financial Institutions Examination Council (US) | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
11 | http://www.dowjones.com | Dow Jones & Company | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
13 | http://www.ism.ws/ | Institute for Supply Management | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
14 | https://www.umich.edu/ | University of Michigan | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
15 | http://www.whitehouse.gov/cea/ | Council of Economic Advisers (US) | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
16 | http://www.whitehouse.gov/omb/ | US. Office of Management and Budget | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
17 | http://www.cbo.gov/ | US. Congressional Budget Office | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
Details¶
To request source details, provide a source ID to the details method of the source client:
res = fr.source.details(1)
print res
The response includes the series frequency, observation period, and popularity, among other descriptive features.
id | link | name | realtime_end | realtime_start |
---|---|---|---|---|
1 | http://www.federalreserve.gov/ | Board of Governors of the Federal Reserve System (US) | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
Releases¶
To request source details, provide a source ID to the details method of the source client:
params = {
'limit':10
}
res = fr.source.releases(1,params=params)
print res
The response includes the source ID, name, and a link to the source:
id | link | name | notes | press_release | realtime_end | realtime_start |
---|---|---|---|---|---|---|
13 | http://www.federalreserve.gov/releases/g17/ | G.17 Industrial Production and Capacity Utilization | True | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | |
14 | http://www.federalreserve.gov/releases/g19/ | G.19 Consumer Credit | True | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | |
15 | http://www.federalreserve.gov/releases/g5/ | G.5 Foreign Exchange Rates | True | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | |
17 | http://www.federalreserve.gov/releases/h10/ | H.10 Foreign Exchange Rates | True | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | |
18 | http://www.federalreserve.gov/releases/h15/ | H.15 Selected Interest Rates | True | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | |
19 | http://www.federalreserve.gov/releases/h3/ | H.3 Aggregate Reserves of Depository Institutions and the Monetary Base | True | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | |
20 | http://www.federalreserve.gov/releases/h41/ | H.4.1 Factors Affecting Reserve Balances | True | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | |
21 | http://www.federalreserve.gov/releases/h6/ | H.6 Money Stock Measures | True | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | |
22 | http://www.federalreserve.gov/releases/h8/ | H.8 Assets and Liabilities of Commercial Banks in the United States | True | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | |
52 | http://www.federalreserve.gov/releases/z1/ | Z.1 Financial Accounts of the United States |
|
True | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 |
Tags¶
Economic data series derive from a variety of sources,including the Federal Reserve Bank, Bureau of Labor Statistics,Bureau of Economic Analysis, and Census Bureau.
All tags¶
Get all tags:
params = {
'limit':10
}
res = fr.tag.tags(params=params)
print res
The response includes the group ID, name, and popularity:
created | group_id | name | notes | popularity | series_count |
---|---|---|---|---|---|
2012-02-27 16:18:19 | seas | nsa | Not seasonally adjusted | 97 | 326950 |
2012-02-27 16:18:19 | geo | usa | United States of America | 100 | 248427 |
2012-02-27 16:18:19 | freq | annual | 84 | 222080 | |
2012-02-27 16:18:19 | geot | nation | Country Level | 100 | 163584 |
2012-02-27 16:18:19 | src | census | US. Bureau of the Census | 79 | 121069 |
2012-02-27 16:18:19 | geot | county | County, Parish, or Borough Level | 68 | 100793 |
2012-02-27 16:18:19 | src | bls | US. Bureau of Labor Statistics | 86 | 100575 |
2012-02-27 16:18:19 | freq | monthly | 94 | 94751 | |
2012-02-27 16:18:19 | gen | employment | 77 | 88557 | |
2015-12-30 19:26:34 | rls | saipe | Small Area Income and Poverty Estimates (SAIPE) | 50 | 80957 |
Series¶
Get series associated with tags:
params = {
'limit':2
}
res = fr.tag.series('slovenia;food',params=params)
print res
The response includes the series details:
frequency | frequency_short | id | last_updated | notes | observation_end | observation_start | popularity | realtime_end | realtime_start | seasonal_adjustment | seasonal_adjustment_short | title | units | units_short |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Monthly | M | 00XEFDSIM086NEST | 2015-12-16 16:08:23 | The Harmonized Index of Consumer Prices category “Overall Index Excluding Energy, Food, Alcohol, and Tobacco (00XEFOOD)” is a classification of nondurable goods, semi-durable goods, durable goods, and services that includes Clothing Materials (03.1.1), Garments (03.1.2), Other Articles of Clothing and Clothing Accessories (03.1.3), Cleaning, Repair, and Hire of Clothing (03.1.4), Shoes and Other Footwear including Repair and Hire of Footwear (03.2.1/2), Actual Rentals Paid by Tenants including Other Actual Rentals (04.1.1/2), Materials for the Maintenance and Repair of the Dwelling (04.3.1), Services for the Maintenance and Repair of the Dwelling (04.3.2), Water Supply (04.4.1), Refuse Collection (04.4.2), Sewerage Collection (04.4.3), Other Services Relating to the Dwelling, Not Elsewhere Classified (04.4.4), Furniture and Furnishings (05.1.1), Carpets and Other Floor Coverings (05.1.2), Repair of Furniture, Furnishings, and Floor Coverings (05.1.3), Household Textiles (05.2), Major Household Appliances whether Electric or not and Small Electric Household Appliances (05.3.1/2), Repair of Household Appliances (05.3.3), Glassware, Tableware, and Household Utensils (05.4), Major Tools and Equipment and Small Tools and Miscellaneous Accessories (05.5.1/2), Nondurable Household Goods (05.6.1), Domestic Services and Household Services (05.6.2), Pharmaceutical Products (06.1.1), Other Medical Products, Therapeutic Appliances and Equipment (06.1.2/3), Medical and Paramedical Services (06.2.1/3), Dental Services (06.2.2), Hospital Services (06.3), Motor Cars (07.1.1), Motor Cycles, Bicycles, and Animal Drawn Vehicles (07.1.2/3/4), Spare Parts and Accessories for Personal Transport Equipment (07.2.1), Maintenance and Repair of Personal Transport Equipment (07.2.3), Other Services in respect of Personal Transport Equipment (07.2.4), Passenger Transport by Railway (07.3.1), Passenger Transport by Road (07.3.2), Passenger Transport by Air (07.3.3), Passenger Transport by Sea and Inland Waterway (07.3.4), Combined Passenger Transport (07.3.5), Other Purchased Transport Services (07.3.6), Postal Services (08.1), Telephone and Telefax Equipment and Telephone and Telefax Services (08.2/3), Equipment for the Reception, Recording, and Reproduction of Sound and Pictures (09.1.1), Photographic and Cinematographic Equipment and Optical Instruments (09.1.2), Information Processing Equipment (09.1.3), Recording Media (09.1.4), Repair of Audio-Visual, Photographic and Information Processing Equipment (09.1.5), Major Durables for Indoor and Outdoor Recreation including Musical Instruments (09.2.1/2), Maintenance and Repair of Other Major Durables for Recreation and Culture (09.2.3), Games, Toys, and Hobbies (09.3.1), Equipment for Sport, Camping, and Open-Air Recreation (09.3.2), Gardens, Plants, and Flowers (09.3.3), Pets and Related Products including Veterinary and Other Services for Pets (09.3.4/5), Recreational and Sporting Services (09.4.1), Cultural Services (09.4.2), Books (09.5.1), Newspapers and Periodicals (09.5.2), Miscellaneous Printed Matter, Stationery, and Drawing Materials (09.5.3/4), Package Holidays (09.6), Pre-Primary and Primary, Secondary, Post-Secondary Non-Tertiary, Tertiary Education, and Education not definable by Level (10.X), Restaurants, cafés, and the Like (11.1.1), Canteens (11.1.2), Accommodation Services (11.2), Hairdressing Salons and Personal Grooming Establishments (12.1.1), Electric Appliances for Personal Care and Other Appliances, Articles, and Products for Personal Care (12.1.2/3), Jewelry, Clocks, and Watches (12.3.1), Other Personal Effects (12.3.2), Social Protection (12.4), Insurance connected with the Dwelling (12.5.2), Insurance connected with Health (12.5.3), Insurance connected with Transport (12.5.4), Other Insurance (12.5.5) Other Financial Services , Not Elsewhere Classified (12.6.2), and Other Services, Not Elsewhere Classified (12.7).
|
2015-11-01 00:00:00 | 1999-12-01 00:00:00 | 0 | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | Not Seasonally Adjusted | NSA | Harmonized Index of Consumer Prices: Overall Index Excluding Energy, Food, Alcohol, and Tobacco for Slovenia© | Index 2005=100 | Index 2005=100 |
Monthly | M | 00XESESIM086NEST | 2015-12-16 16:08:16 | The Harmonized Index of Consumer Prices category “Overall Index Excluding Energy and Seasonal Food (00XESEAS)” is a classification of nondurable goods, semi-durable goods, durable goods, and services that includes Bread and Cereals (01.1.1), Meat (01.1.2), Milk, Cheese, and Eggs (01.1.4), Oils and Fats (01.1.5), Sugar, Jam, Honey, Chocolate, and Confectionery (01.1.8), Food Products, Not Elsewhere Classified (01.1.9), Coffee, Tea, and Cocoa (01.2.1), Mineral Waters, Soft Drinks, and Fruit and Vegetable Juices (01.2.2), Spirits (02.1.1), Wine (02.1.2), Beer (02.1.3), Tobacco (02.2), Clothing Materials (03.1.1), Garments (03.1.2), Other Articles of Clothing and Clothing Accessories (03.1.3), Cleaning, Repair, and Hire of Clothing (03.1.4), Shoes and Other Footwear including Repair and Hire of Footwear (03.2.1/2), Actual Rentals Paid by Tenants including Other Actual Rentals (04.1.1/2), Materials for the Maintenance and Repair of the Dwelling (04.3.1), Services for the Maintenance and Repair of the Dwelling (04.3.2), Water Supply (04.4.1), Refuse Collection (04.4.2), Sewerage Collection (04.4.3), Other Services Relating to the Dwelling, Not Elsewhere Classified (04.4.4), Furniture and Furnishings (05.1.1), Carpets and Other Floor Coverings (05.1.2), Repair of Furniture, Furnishings, and Floor Coverings (05.1.3), Household Textiles (05.2), Major Household Appliances whether Electric or not and Small Electric Household Appliances (05.3.1/2), Repair of Household Appliances (05.3.3), Glassware, Tableware, and Household Utensils (05.4), Major Tools and Equipment and Small Tools and Miscellaneous Accessories (05.5.1/2), Nondurable Household Goods (05.6.1), Domestic Services and Household Services (05.6.2), Pharmaceutical Products (06.1.1), Other Medical Products, Therapeutic Appliances and Equipment (06.1.2/3), Medical and Paramedical Services (06.2.1/3), Dental Services (06.2.2), Hospital Services (06.3), Motor Cars (07.1.1), Motor Cycles, Bicycles, and Animal Drawn Vehicles (07.1.2/3/4), Spare Parts and Accessories for Personal Transport Equipment (07.2.1), Maintenance and Repair of Personal Transport Equipment (07.2.3), Other Services in respect of Personal Transport Equipment (07.2.4), Passenger Transport by Railway (07.3.1), Passenger Transport by Road (07.3.2), Passenger Transport by Air (07.3.3), Passenger Transport by Sea and Inland Waterway (07.3.4), Combined Passenger Transport (07.3.5), Other Purchased Transport Services (07.3.6), Postal Services (08.1), Telephone and Telefax Equipment and Telephone and Telefax Services (08.2/3), Equipment for the Reception, Recording, and Reproduction of Sound and Pictures (09.1.1), Photographic and Cinematographic Equipment and Optical Instruments (09.1.2), Information Processing Equipment (09.1.3), Recording Media (09.1.4), Repair of Audio-Visual, Photographic and Information Processing Equipment (09.1.5), Major Durables for Indoor and Outdoor Recreation including Musical Instruments (09.2.1/2), Maintenance and Repair of Other Major Durables for Recreation and Culture (09.2.3), Games, Toys, and Hobbies (09.3.1), Equipment for Sport, Camping, and Open-Air Recreation (09.3.2), Gardens, Plants, and Flowers (09.3.3), Pets and Related Products including Veterinary and Other Services for Pets (09.3.4/5), Recreational and Sporting Services (09.4.1), Cultural Services (09.4.2), Books (09.5.1), Newspapers and Periodicals (09.5.2), Miscellaneous Printed Matter, Stationery, and Drawing Materials (09.5.3/4), Package Holidays (09.6), Pre-Primary and Primary, Secondary, Post-Secondary Non-Tertiary, Tertiary Education, and Education not definable by Level (10.X), Restaurants, cafés, and the Like (11.1.1), Canteens (11.1.2), Accommodation Services (11.2), Hairdressing Salons and Personal Grooming Establishments (12.1.1), Electric Appliances for Personal Care and Other Appliances, Articles, and Products for Personal Care (12.1.2/3), Jewelry, Clocks, and Watches (12.3.1), Other Personal Effects (12.3.2), Social Protection (12.4), Insurance connected with the Dwelling (12.5.2), Insurance connected with Health (12.5.3), Insurance connected with Transport (12.5.4), Other Insurance (12.5.5) Other Financial Services , Not Elsewhere Classified (12.6.2), and Other Services, Not Elsewhere Classified (12.7).
|
2015-11-01 00:00:00 | 1999-12-01 00:00:00 | 0 | 2016-01-10 00:00:00 | 2016-01-10 00:00:00 | Not Seasonally Adjusted | NSA | Harmonized Index of Consumer Prices: Overall Index Excluding Energy and Seasonal Food for Slovenia© | Index 2005=100 | Index 2005=100 |
Related tags¶
Get related tags:
params = {
'limit':5,
'exclude_tag_names':'goods',
'sort_order':'desc'
}
res = fr.tag.related_tags('services;quarterly',params=params)
print res
The response includes the group ID, name, and popularity:
created | group_id | name | notes | popularity | series_count |
---|---|---|---|---|---|
2012-02-27 16:18:19 | geot | nation | Country Level | 100 | 1752 |
2012-02-27 16:18:19 | seas | nsa | Not seasonally adjusted | 97 | 1230 |
2012-02-27 16:18:19 | geo | usa | United States of America | 100 | 1200 |
2012-08-16 20:21:17 | rls | mei | Main Economic Indicators | 77 | 1172 |
2012-02-27 16:18:19 | src | oecd | Organisation for Economic Co-operation and Development | 77 | 1172 |
API Documentation¶
All API calls map the raw REST api as closely as possible, including the distinction between required and optional arguments to the calls. This means that the code makes distinction between positional and keyword arguments; we, however, recommend that people use keyword arguments for all calls for consistency and safety.
Fred¶
-
class
fred.
Fred
(api_key='abcdefghijklmnopqrstuvwxyz123456', response_type='xml')[source]¶ Fred client. Provides a straightforward mapping from Python to FRED REST endpoints. The instance has attributes
cateogry
,release
,series
,tag
andsource
that provide access to instances offred.clients.categories.CategoriesClient
,fred.clients.releases.ReleasesClient
,fred.clients.eseries.ESeriesClient
,fred.clients.tags.TagsClient
andfred.clients.sources.SourcesClient
respectively. This is the preferred (and only supported) way to get access to those classes and their methods.Parameters:
Categories¶
-
class
fred.clients.categories.
CategoriesClient
(client, api_key, url_root, response_type)[source]¶ Class for working with FRED categories
-
children
(*args, **kwargs)[source]¶ Function to request a particular category’s children https://research.stlouisfed.org/docs/api/fred/category_children.html
Parameters: - category_id (int) – The id for a category. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
-
details
(*args, **kwargs)[source]¶ Function to request a particular category’s high-level details https://research.stlouisfed.org/docs/api/fred/category.html
Parameters:
Function to request a particular category’s related categories. Related categories are A related category is a one-way relation between 2 categories that is not part of a parent-child category hierarchy. Most categories do not have related categories. https://research.stlouisfed.org/docs/api/fred/category_related.html
Parameters: - category_id (int) – The id for a category. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
Function to request FRED related tags for a particular category. FRED tags are attributes assigned to series. Series are assigned tags and categories. Indirectly through series, it is possible to get the tags for a category. No tags exist for a category that does not have series. https://research.stlouisfed.org/docs/api/fred/category_tags.html
Parameters: - category_id (int) – The id for a category. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- tag_names (str) – Tag names that series match. Required. Separate with semicolon as in “income;bea”
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_id’, ‘title’, ‘units’, ‘frequency’, ‘seasonal_adjustment’, ‘realtime_start’, ‘realtime_end’, ‘last_updated’, ‘observation_start’, ‘observation_end’, ‘popularity’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- exclude_tag_names (str) – Tag names to exclude. Separate with semicolon as in “income;bea”
- tag_group_id (str) – Tag ID to filter tags by. Options are ‘freq’, ‘gen’, ‘geo’, ‘geot’, ‘rls’, ‘seas’, ‘src’
- search_text (str) – The words to find matching tags with. For example ‘mortgage rates’
-
series
(*args, **kwargs)[source]¶ Function to request a particular category’s data series https://research.stlouisfed.org/docs/api/fred/category_series.html
Parameters: - category_id (int) – The id for a category. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_id’, ‘title’, ‘units’, ‘frequency’, ‘seasonal_adjustment’, ‘realtime_start’, ‘realtime_end’, ‘last_updated’, ‘observation_start’, ‘observation_end’, ‘popularity’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- filter_variable (str) – The attribute to filter results by. Options are ‘frequency’, ‘units’,’seasonal_adjustment’
- filter_value (str) – The value of the filter_variable attribute to filter results by.
- tag_names (str) – Tag names used to match series. Separate with semicolon as in “income;bea”
- exclude_tag_names (str) – Tag names used to exclude series. Separate with semicolon as in “income;bea”
Function to request a particular category’s FRED tags. FRED tags are attributes assigned to series. Series are assigned tags and categories. Indirectly through series, it is possible to get the tags for a category. No tags exist for a category that does not have series. https://research.stlouisfed.org/docs/api/fred/category_tags.html
Parameters: - category_id (int) – The id for a category. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_id’, ‘title’, ‘units’, ‘frequency’, ‘seasonal_adjustment’, ‘realtime_start’, ‘realtime_end’, ‘last_updated’, ‘observation_start’, ‘observation_end’, ‘popularity’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- tag_names (str) – Tag names to only include in the response. Separate with semicolon as in “income;bea”
- tag_group_id (str) – Tag ID to filter tags by. Options are ‘freq’, ‘gen’, ‘geo’, ‘geot’, ‘rls’, ‘seas’, ‘src’
- search_text (str) – The words to find matching tags with. For example ‘mortgage rates’
-
Releases¶
-
class
fred.clients.releases.
ReleasesClient
(client, api_key, url_root, response_type)[source]¶ Class for working with FRED releases
-
all_dates
(*args, **kwargs)[source]¶ Function to request release dates for all releases of economic data. https://research.stlouisfed.org/docs/api/fred/releases_dates.html
Parameters: - response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘release_date’, ‘release_id’, ‘release_name’.
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- include_release_dates_with_no_data (str) – Determines whether release dates with no data available are returned. Options are ‘true’, ‘false’
-
all_releases
(*args, **kwargs)[source]¶ Function to request all releases of economic data. https://research.stlouisfed.org/docs/api/fred/releases.html
Parameters: - response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘release_id’, ‘name’, ‘press_release’, ‘realtime_start’, ‘realtime_end’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
-
dates
(*args, **kwargs)[source]¶ Function to request release dates for a particular release of economic data. Note that release dates are published by data sources and do not necessarily represent when data will be available on the FRED or ALFRED websites. https://research.stlouisfed.org/docs/api/fred/release_dates.html
Parameters: - release_id (int) – The id for a release. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- sort_order (str) – Sort results is ascending or descending release date order. Options are ‘asc’,’desc’
- include_release_dates_with_no_data (str) – Determines whether release dates with no data available are returned. Options are ‘true’, ‘false’
-
details
(*args, **kwargs)[source]¶ Function to request the high-level details for a particular release of economic data.. https://research.stlouisfed.org/docs/api/fred/release.html
Parameters: - release_id (int) – The id for a release. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
Function to request FRED related tags for a particular release. FRED tags are attributes assigned to series. Series are assigned tags and releases. Indirectly through series, it is possible to get the tags for a category. No tags exist for a release that does not have series. https://research.stlouisfed.org/docs/api/fred/release_related_tags.html
Parameters: - release_id (int) – The id for a release. Required.
- tag_names (str) – Tag names that series match. Separate with semicolon as in “income;bea”. Required
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_count’, ‘popularity’, ‘created’, ‘name’, ‘group_id’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- exclude_tag_names (str) – Tag names to exclude. Separate with semicolon as in “income;bea”
- tag_group_id (str) – Tag ID to filter tags by. Options are ‘freq’, ‘gen’, ‘geo’, ‘geot’, ‘rls’, ‘seas’, ‘src’
- search_text (str) – The words to find matching tags with. For example ‘mortgage rates’
-
series
(*args, **kwargs)[source]¶ Function to request the series on a release of economic data. https://research.stlouisfed.org/docs/api/fred/release_series.html
Parameters: - release_id (int) – The id for a release. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_id’, ‘title’, ‘units’, ‘frequency’, ‘seasonal_adjustment’, ‘realtime_start’, ‘realtime_end’, ‘last_updated’, ‘observation_start’, ‘observation_end’, ‘popularity’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- filter_variable (str) – The attribute to filter results by. Options are ‘frequency’, ‘units’,’seasonal_adjustment’
- filter_value (str) – The value of the filter_variable attribute to filter results by.
- tag_names (str) – Tag names used to match series. Separate with semicolon as in “income;bea”
- exclude_tag_names (str) – Tag names used to exclude series. Separate with semicolon as in “income;bea”
-
sources
(*args, **kwargs)[source]¶ Function to request the sources for a particular release of economic data. https://research.stlouisfed.org/docs/api/fred/release.html
Parameters: - release_id (int) – The id for a release. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
Function to request FRED tags for a particular release. FRED tags are attributes assigned to series. Series are assigned tags and releases. Indirectly through series, it is possible to get the tags for a category. No tags exist for a release that does not have series. https://research.stlouisfed.org/docs/api/fred/release_tags.html
Parameters: - release_id (int) – The id for a release. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_count’, ‘popularity’, ‘created’, ‘name’, ‘group_id’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- tag_names (str) – Tag names that series match. Separate with semicolon as in “income;bea”
- tag_group_id (str) – Tag ID to filter tags by. Options are ‘freq’, ‘gen’, ‘geo’, ‘geot’, ‘rls’, ‘seas’, ‘src’
- search_text (str) – The words to find matching tags with. For example ‘mortgage rates’
-
Series¶
-
class
fred.clients.eseries.
ESeriesClient
(client, api_key, url_root, response_type)[source]¶ Class for working with FRED series
-
categories
(*args, **kwargs)[source]¶ Function to request the categories for an economic data series. https://research.stlouisfed.org/docs/api/fred/release.html
Parameters: - series_id (int) – The id for a series. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
-
details
(*args, **kwargs)[source]¶ Function to request a series of economic data. https://research.stlouisfed.org/docs/api/fred/release.html
Parameters: - series_id (int) – The id for a series. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
-
observations
(*args, **kwargs)[source]¶ Function to request the observations or data values for an economic data series. https://research.stlouisfed.org/docs/api/fred/series_observations.html
Parameters: - series_id (int) – The id for a series. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 100000
- offset (int) – Data offset. Options >=0
- sort_order (str) – Sort results is ascending or descending observation_date order. Options are ‘asc’,’desc’
- observation_start (str) – The start of the observation period. Format “YYYY-MM-DD”
- observation_end (str) – The end of the observation period. Format “YYYY-MM-DD”
- units (str) – A key that indicates a data value transformation. Options are ‘lin’, ‘chg’, ‘ch1’, ‘pch’, ‘pc1’, ‘pca’, ‘cch’, ‘cca’, ‘log’
- frequency (str) – Indicates a lower frequency to aggregate values. Options are ‘d’, ‘w’, ‘bw’, ‘m’, ‘q’, ‘sa’, ‘a’, ‘wef’, ‘weth’, ‘wew’, ‘wetu’, ‘wem’, ‘wesu’, ‘wesa’, ‘bwew’, ‘bwem’
- aggregation_method (str) – Indicates the aggregation method used for frequency aggregation. Options are ‘avg’, ‘sum’, ‘eop’
- output_type (int) – Output type. Options are 1, 2, 3, 4
- vintage_dates (str) – Date(s) in history. Format “YYYY-MM-DD”. Example for multiple dates “2000-01-01,2005-02-24,...”
-
release
(*args, **kwargs)[source]¶ Function to request the release for an economic data series. https://research.stlouisfed.org/docs/api/fred/series_release.html
Parameters: - series_id (int) – The id for a series. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
-
search
(*args, **kwargs)[source]¶ Function to request economic data series that match search text. https://research.stlouisfed.org/docs/api/fred/series_search.html
Parameters: - search_text (str) – The words to match against economic data series. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- search_type (str) – Determines the type of search to perform. Options are ‘full_text’,’series_id’
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘search_rank’, ‘series_id’, ‘title’, ‘units’, ‘frequency’, ‘seasonal_adjustment’, ‘realtime_start’, ‘realtime_end’, ‘last_updated’, ‘observation_start’, ‘observation_end’, ‘popularity’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- filter_variable (str) – The attribute to filter results by. Options are ‘frequency’, ‘units’,’seasonal_adjustment’
- filter_value (str) – The value of the filter_variable attribute to filter results by.
- tag_names (str) – Tag names used to match series. Separate with semicolon as in “income;bea”
- exclude_tag_names (str) – Tag names used to exclude series. Separate with semicolon as in “income;bea”
Function to request the related FRED tags for one or more FRED tags matching a series search. https://research.stlouisfed.org/docs/api/fred/series_search_related_tags.html
Parameters: - series_search_text (str) – The words to match against economic data series. Required.
- tag_names (str) – Tag names that series match. Separate with semicolon as in “income;bea”. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_count’, ‘popularity’, ‘created’, ‘name’, ‘group_id’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- tag_group_id (str) – Tag ID to filter tags by. Options are ‘freq’, ‘gen’, ‘geo’, ‘geot’, ‘rls’, ‘seas’, ‘src’
- tag_search_text (str) – The words to find matching tags with.
- exclude_tag_names (str) – Tag names to exclude. Separate with semicolon as in “income;bea”
Function to request the FRED tags for a series search. https://research.stlouisfed.org/docs/api/fred/series_search_tags.html
Parameters: - series_search_text (str) – The words to match against economic data series. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_count’, ‘popularity’, ‘created’, ‘name’, ‘group_id’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- tag_names (str) – Tag names that series match. Separate with semicolon as in “income;bea”
- tag_group_id (str) – Tag ID to filter tags by. Options are ‘freq’, ‘gen’, ‘geo’, ‘geot’, ‘rls’, ‘seas’, ‘src’
- tag_search_text (str) – The words to find matching tags with.
Function to request FRED tags for a particular series. FRED tags are attributes assigned to series. https://research.stlouisfed.org/docs/api/fred/series_tags.html
Parameters: - series_id (int) – The id for a series. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_count’, ‘popularity’, ‘created’, ‘name’, ‘group_id’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
-
updates
(*args, **kwargs)[source]¶ Function to request economic data series sorted by when observations were updated on the FRED server (attribute last_updated). Results are limited to series updated within the last two weeks. https://research.stlouisfed.org/docs/api/fred/series_updates.html
Parameters: - series_id (int) – The id for a series. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- filter_value (str) – Limit results by geographic type of economic data series. Options are ‘macro’, ‘regional’, and ‘all’
-
vintage_dates
(*args, **kwargs)[source]¶ Function to request the dates in history when a series’ data values were revised or new data values were released. Vintage dates are the release dates for a series excluding release dates when the data for the series did not change. https://research.stlouisfed.org/docs/api/fred/series_vintagedates.html
Parameters: - series_id (int) – The id for a series. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- sort_order (str) – Sort results by vintage_date. Options are ‘asc’,’desc’
-
Sources¶
-
class
fred.clients.sources.
SourcesClient
(client, api_key, url_root, response_type)[source]¶ Class for working with FRED sources
-
details
(*args, **kwargs)[source]¶ Function to request a particular source of economic data. https://research.stlouisfed.org/docs/api/fred/source.html
Parameters: - source_id (int) – The id for a source. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
-
releases
(*args, **kwargs)[source]¶ Function to request all releases of economic data. https://research.stlouisfed.org/docs/api/fred/releases.html
Parameters: - source_id (int) – The id for a source. Required.
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘source_id’, ‘name’, ‘realtime_start’, ‘realtime_end’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
-
sources
(*args, **kwargs)[source]¶ Function to request all sources of economic data. https://research.stlouisfed.org/docs/api/fred/sources.html
Parameters: - response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘source_id’, ‘name’, ‘realtime_start’, ‘realtime_end’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
-
Tags¶
Class for working with FRED tags
Function to request FRED related tags. FRED tags are attributes assigned to series. https://research.stlouisfed.org/docs/api/fred/related_tags.html
Parameters: - tag_names (str) – Tag names that series match. Required. Separate with semicolon as in “income;bea”
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_count’, ‘popularity’, ‘created’, ‘name’, ‘group_id’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- exclude_tag_names (str) – Tag names to exclude. Separate with semicolon as in “income;bea”
- tag_group_id (str) – Tag ID to filter tags by. Options are ‘freq’, ‘gen’, ‘geo’, ‘geot’, ‘rls’, ‘seas’, ‘src’
- search_text (str) – The words to find matching tags with. For example ‘mortgage rates’
Function to request series matching all tags in the tag_names parameter. https://research.stlouisfed.org/docs/api/fred/category_series.html
Parameters: - tag_names (str) – Tag names that series match. Required. Separate with semicolon as in “income;bea”
- response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_id’, ‘title’, ‘units’, ‘frequency’, ‘seasonal_adjustment’, ‘realtime_start’, ‘realtime_end’, ‘last_updated’, ‘observation_start’, ‘observation_end’, ‘popularity’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- exclude_tag_names (str) – Tag names used to exclude series. Separate with semicolon as in “income;bea”
Function to request FRED tags. FRED tags are attributes assigned to series. https://research.stlouisfed.org/docs/api/fred/tags.html
Parameters: - response_type (str) – File extension of response. Options are ‘xml’, ‘json’, ‘dict’,’df’,’numpy’,’csv’,’tab,’pipe’. Required.
- realtime_start (str) – The start of the real-time period. Format “YYYY-MM-DD”
- realtime_end (str) – The end of the real-time period. Format “YYYY-MM-DD”
- limit (int) – The maximum number of results to return. Options 1 to 1000
- offset (int) – Data offset. Options >=0
- order_by (str) – Order results by values of the specified attribute. Options are ‘series_count’, ‘popularity’, ‘created’, ‘name’, ‘group_id’
- sort_order (str) – Sort results for attribute values specified by order_by. Options are ‘asc’,’desc’
- tag_names (str) – Tag names to only include in the response. Separate with semicolon as in “income;bea”
- tag_group_id (str) – Tag ID to filter tags by. Options are ‘freq’, ‘gen’, ‘geo’, ‘geot’, ‘rls’, ‘seas’, ‘src’
- search_text (str) – The words to find matching tags with. For example ‘mortgage rates’
License¶
The MIT License (MIT)
Copyright (c) 2016 Aleksandar Velkoski https://github.com/avelkoski
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.
Affiliation¶
The author is affiliated with the Data Science division of the National Association of REALTORS.