fred_search#
Purpose#
Get economic data series that match search text.
Format#
- x = fred_search(search_text[, ...])#
- Parameters:
search_text (String) – The words to match against economic data series. required.
options (key, value pairs) –
Options to pass to the API. See below. These can be set directly when calling the function in the form of consecutive (key, value) pairs or via a dataframe constructed with
fred_set()
. All arguments can be specified in any order. For example:/* Do a search on 'unemployment' with the following arguments: ** limit = 10 ** sort_order = desc */ fred_search("unemployment", "limit", 10, "sort_order", "desc")
This function supports the following options:
search_type
String. Determines the type of search to perform. One of the following strings: ‘full_text’, ‘series_id’. optional, default: full_text.
’full_text’ searches series attributes title, units, frequency, and tags by parsing words into stems. This makes it possible for searches like ‘Industry’ to match series containing related words such as ‘Industries’. Of course, you can search for multiple words like ‘money’ and ‘stock’. Text will be url encoded automatically.
’series_id’ performs a substring search on series IDs. Searching for ‘ex’ will find series containing ‘ex’ anywhere in a series ID. ‘*’ can be used to anchor searches and match 0 or more of any character. Searching for ‘ex*’ will find series containing ‘ex’ at the beginning of a series ID. Searching for ‘*ex’ will find series containing ‘ex’ at the end of a series ID. It’s also possible to put an ‘*’ in the middle of a string. ‘m*sl’ finds any series starting with ‘m’ and ending with ‘sl’.
realtime_start
YYYY-MM-DD formatted string. The start of the real-time period. For more information, see Remarks. optional, default: today’s date
realtime_end
YYYY-MM-DD formatted string. The end of the real-time period. For more information, see Remarks. optional, default: today’s date
limit
integer between 1 and 1000. The maximum number of results to return. optional, default: 1000
offset
non-negative integer. Order results by values of the specified attribute. optional, default: 0
order_by
String. Order results by values of the specified attribute.
One of the following strings: ‘search_rank’, ‘series_id’, ‘title’, ‘units’, ‘frequency’, ‘seasonal_adjustment’, ‘realtime_start’, ‘realtime_end’, ‘last_updated’, ‘observation_start’, ‘observation_end’, ‘popularity’, ‘group_popularity’. optional, default:
If the value of search_type is ‘full_text’ then the default value of order_by is ‘search_rank’.
If the value of search_type is ‘series_id’ then the default value of order_by is ‘series_id’.
sort_order
String. Sort results in ascending or descending order for attribute values specified by order_by. One of the following strings: ‘asc’, ‘desc’. optional, default: If order_by is equal to ‘search_rank’ or ‘popularity’, then the default value of sort_order is ‘desc’. Otherwise, the default sort order is ‘asc’.
filter_variable
One of the following strings: ‘frequency’. The attribute to filter results by. ‘units’, ‘seasonal_adjustment’. optional, no filter by default
filter_value
String. The value of the filter_variable attribute to filter results by. optional, no filter by default
tag_names
String. A semicolon delimited list of tag names that series match all of. optional, no filtering by tags by default
Example value: ‘usa;m2’. Filter results to series having both tags ‘usa’ and ‘m2’. See the related request
fred_tags()
.exclude_tag_names
String. A semicolon delimited list of tag names that series match none of. optional, no filtering by tags by default.
Example value: ‘discontinued;m1’. Filter results to series having neither tag ‘discontinued’ nor tag ‘m1’. Parameter exclude_tag_names requires that parameter tag_names also be set to limit the number of matching series.
- Returns:
x (Dataframe) – Results.
Examples#
fred_search("monetary service index");
frequency frequency_short group_popularity id last_updated notes observation_end observation_star popularity realtime_end realtime_start seasonal_adjustm seasonal_adjustm title units units_short
Monthly M 22.000000 MSIM2 2014-01-17 07:16 The MSI measure 2013-12-01 1967-01-01 22.000000 2022-10-31 2022-10-31 Seasonally Adjus SA Monetary Service Billions of Doll Bil. of $
Monthly M 18.000000 MSIMZMP 2014-01-17 07:16 The MSI measure 2013-12-01 1967-01-01 18.000000 2022-10-31 2022-10-31 Seasonally Adjus SA Monetary Service Billions of Doll Bil. of $
Monthly M 14.000000 OCM2P 2014-01-17 07:16 Preferred benchm 2013-12-01 1967-01-01 14.000000 2022-10-31 2022-10-31 Not Seasonally A NSA Real User Cost I Percent %
Monthly M 13.000000 MSIALLP 2014-01-17 07:16 The MSI measure 2013-12-01 1967-01-01 13.000000 2022-10-31 2022-10-31 Seasonally Adjus SA Monetary Service Billions of Doll Bil. of $
Monthly M 10.000000 MSIM2A 2014-01-17 07:16 The MSI measure 2013-12-01 1967-01-01 10.000000 2022-10-31 2022-10-31 Seasonally Adjus SA Monetary Service Billions of Doll Bil. of $
Remarks#
API Key#
This function requires a valid API key. Please visit https://fred.stlouisfed.org/docs/api/api_key.html to find out more on how to obtain one.
Set your API key using any of the following methods in GAUSS:
Set the API key directly at the top of your program:
FRED_API_KEY = "your_api_key"
Set the environment variable
FRED_API_KEY
to your API key.Edit your gauss.cfg file and modify the
fred_api_key
value:fred_api_key = your_api_key
Disclaimer#
Note
This product uses the FRED® API but is not endorsed or certified by the Federal Reserve Bank of St. Louis.
Real-Time Periods#
You can read extensively about the real-time period parameters directly on the FRED Website at https://fred.stlouisfed.org/docs/api/fred/realtime_period.html
Per the FRED website:
The real-time period marks when facts were true or when information was known until it changed. Economic data sources, releases, series, and observations are all assigned a real-time period. Sources, releases, and series can change their names, and observation data values can be revised.
On almost all URLs, the default real-time period is today. This can be thought of as FRED® mode- what information about the past is available today. ALFRED® users can change the real-time period to retrieve information that was known as of a past period of history.
The real-time period can be specified by setting the realtime_start and realtime_end variables. Variables realtime_start and realtime_end are optional YYYY-MM-DD formatted dates that default to today’s date. The real-time period set by realtime_start and realtime_end is a (closed, closed) period. This means that the real-time period includes the dates or boundaries set by realtime_start and realtime_end.
See also