Functions for the FRED Series endpoints.
Series are the core data type in FRED - each series is a time series of economic observations (e.g., GDP, unemployment rate, CPI).
Endpoints
get/2-/fred/series- Get series metadatacategories/2-/fred/series/categories- Get categories for a seriesobservations/2-/fred/series/observations- Get the actual data valuesrelease/2-/fred/series/release- Get the release a series belongs tosearch/2-/fred/series/search- Search for series by textsearch_tags/2-/fred/series/search/tags- Get tags for a searchsearch_related_tags/2-/fred/series/search/related_tagstags/2-/fred/series/tags- Get tags for a seriesupdates/1-/fred/series/updates- Get recently updated seriesvintage_dates/2-/fred/series/vintagedates- Get revision dates
Summary
Functions
Get the categories for an economic data series.
Get an economic data series.
Get the observations or data values for an economic data series.
Same as observations/2 except this returns the observation data
inside of an Explorer.DataFrame. You can also pass in a list of
series ids and all of the series will be packaged into the
Explorer.DataFrame. Since series can all have different dates,
the union of all of the dates across all of the series will populate
the date column and series without data for that date will have a nil
value.
Get the release for an economic data series.
Search for economic data series that match keywords.
Get the related tags for a series search.
Get the tags for a series search.
Get the FRED tags for an economic data series.
Get economic data series sorted by when observations were updated on the FRED server.
Get the dates in history when a series' data values were revised or new data values were released.
Functions
@spec categories(series_id :: String.t(), opts :: keyword()) :: Fred.Client.response()
Get the categories for an economic data series.
Options
:realtime_end(struct of typeDate) - End of the real-time period.:realtime_start(struct of typeDate) - Start of the real-time period.
Examples
iex> {:ok, categories} = Fred.Series.categories("UNRATE")
iex> %{"categories" => [_ | _]} = categories
iex> {:error, %Fred.Error{type: :option_error}} =
...> Fred.Series.categories("UNRATE", realtime_start: "Bad Input")
@spec get(series_id :: String.t(), opts :: keyword()) :: Fred.Client.response()
Get an economic data series.
Returns metadata about a series including its title, frequency, units, seasonal adjustment, and more.
Options
:realtime_end(struct of typeDate) - End of the real-time period.:realtime_start(struct of typeDate) - Start of the real-time period.
Examples
iex> {:ok, series} = Fred.Series.get("GDP")
iex> %{"seriess" => [_ | _]} = series
iex> {:error, %Fred.Error{type: :option_error}} =
...> Fred.Series.get("GDP", realtime_start: "Bad Input")
@spec observations(series_id :: String.t(), opts :: keyword()) :: Fred.Client.response()
@spec observations(series_ids :: list() | String.t(), opts :: keyword()) :: {:ok, Explorer.DataFrame.t()} | {:error, term()}
Get the observations or data values for an economic data series.
This is the primary function for retrieving actual time series data from FRED.
Options
:aggregation_method(atom/0) - How the data should be aggregated. Supported values are:
:avg- Average:sum- Sum:eop- End of period
:frequency(atom/0) - Frequency filter. Supported values are::d- Daily:w- Weekly:bw- Biweekly:m- Monthly:q- Quarterly:sa- Semiannual:a- Annual:wef- Weekly, Ending Friday:weth- Weekly, Ending Thursday:wew- Weekly, Ending Wednesday:wetu- Weekly, Ending Tuesday:wem- Weekly, Ending Monday:wesu- Weekly, Ending Sunday:wesa- Weekly, Ending Saturday:bwew- Biweekly, Ending Wednesday:bwem- Biweekly, Ending Monday
:limit(pos_integer/0) - Max results (between 1-100000).:observation_end(struct of typeDate) - End date for observations.:observation_start(struct of typeDate) - Start date for observations.:offset(pos_integer/0) - Result offset.:output_type(atom/0) - Specifies how the real-time output is formated. Supported values are::real_time_period- Observations by real-time period.:all_vintage- Observations by vintage date, all observations.:new_revised_vintage- Observations by vintage date, new and revised observations only.:initial_release- Observations, initial release only.
:realtime_end(struct of typeDate) - End of the real-time period.:realtime_start(struct of typeDate) - Start of the real-time period.:sort_order(atom/0) - The sort order of the results. Supported values are::asc:desc
:units(atom/0) - Data value transformation. Supported values are::lin- Levels (no transformation, default):chg- Change:ch1- Change from year ago:pch- Percent change:pc1- Percent change from year ago:pca- Compounded annual rate of change:cch- Continuously compounded rate of change:cca- Continuously compounded annual rate of change:log- Natural Log
:vintage_dates(list of struct of typeDate) - Dates for historical vintages
Examples
iex> {:ok, observations} = Fred.Series.observations("UNRATE")
iex> %{"observations" => [_ | _]} = observations
iex> {:ok, observations} =
...> Fred.Series.observations("GDP",
...> observation_start: ~D[2020-01-01],
...> frequency: :q,
...> units: :pch
...> )
iex> %{"observations" => [_ | _]} = observations
iex> {:ok, observations} =
...> Fred.Series.observations("GDP",
...> vintage_dates: [~D[2015-01-01], ~D[2015-07-01]]
...> )
iex> %{"observations" => [_ | _]} = observations
iex> {:error, %Fred.Error{type: :option_error}} =
...> Fred.Series.observations("GDP", realtime_start: "Bad Input")
Same as observations/2 except this returns the observation data
inside of an Explorer.DataFrame. You can also pass in a list of
series ids and all of the series will be packaged into the
Explorer.DataFrame. Since series can all have different dates,
the union of all of the dates across all of the series will populate
the date column and series without data for that date will have a nil
value.
Options
:aggregation_method(atom/0) - How the data should be aggregated. Supported values are:
:avg- Average:sum- Sum:eop- End of period
:frequency(atom/0) - Frequency filter. Supported values are::d- Daily:w- Weekly:bw- Biweekly:m- Monthly:q- Quarterly:sa- Semiannual:a- Annual:wef- Weekly, Ending Friday:weth- Weekly, Ending Thursday:wew- Weekly, Ending Wednesday:wetu- Weekly, Ending Tuesday:wem- Weekly, Ending Monday:wesu- Weekly, Ending Sunday:wesa- Weekly, Ending Saturday:bwew- Biweekly, Ending Wednesday:bwem- Biweekly, Ending Monday
:limit(pos_integer/0) - Max results (between 1-100000).:observation_end(struct of typeDate) - End date for observations.:observation_start(struct of typeDate) - Start date for observations.:offset(pos_integer/0) - Result offset.:output_type(atom/0) - Specifies how the real-time output is formated. Supported values are::real_time_period- Observations by real-time period.:all_vintage- Observations by vintage date, all observations.:new_revised_vintage- Observations by vintage date, new and revised observations only.:initial_release- Observations, initial release only.
:realtime_end(struct of typeDate) - End of the real-time period.:realtime_start(struct of typeDate) - Start of the real-time period.:sort_order(atom/0) - The sort order of the results. Supported values are::asc:desc
:units(atom/0) - Data value transformation. Supported values are::lin- Levels (no transformation, default):chg- Change:ch1- Change from year ago:pch- Percent change:pc1- Percent change from year ago:pca- Compounded annual rate of change:cch- Continuously compounded rate of change:cca- Continuously compounded annual rate of change:log- Natural Log
:vintage_dates(list of struct of typeDate) - Dates for historical vintages
Examples
iex> %Explorer.DataFrame{} = Fred.Series.observations_as_data_frame("GDP")
iex> %Explorer.DataFrame{} =
...> Fred.Series.observations_as_data_frame(["GDP", "UNRATE"],
...> observation_start: ~D[2020-01-01],
...> frequency: :q,
...> units: :pch
...> )
iex> %Explorer.DataFrame{} =
...> Fred.Series.observations_as_data_frame("GDP",
...> vintage_dates: [~D[2015-01-01], ~D[2015-07-01]]
...> )
iex> {:error, %Fred.Error{type: :option_error}} =
...> Fred.Series.observations_as_data_frame("GDP", realtime_start: "Bad Input")
@spec release(series_id :: String.t(), opts :: keyword()) :: Fred.Client.response()
Get the release for an economic data series.
Options
:realtime_end(struct of typeDate) - End of the real-time period.:realtime_start(struct of typeDate) - Start of the real-time period.
Examples
iex> {:ok, release} = Fred.Series.release("GDP")
iex> %{"releases" => [_ | _]} = release
iex> {:error, %Fred.Error{type: :option_error}} =
...> Fred.Series.release("GDP", realtime_start: "Bad Input")
@spec search(search_text :: String.t(), opts :: keyword()) :: Fred.Client.response()
Search for economic data series that match keywords.
Options
:exclude_tag_names(list ofString.t/0) - List of tag names to exclude.:filter_value(String.t/0) - The value of the filter_variable attribute to filter results by. This requires that the:filter_variableis also provided.:filter_variable(atom/0) - The attribute to filter results by. Supported values are::frequency:units:seasonal_adjustment
:limit(pos_integer/0) - Max results (between 1-1000).:offset(pos_integer/0) - Result offset.:order_by(atom/0) - Order the results by the provided field. Supported values are::search_rank:series_id:title:units:frequency:seasonal_adjustment:realtime_start:realtime_end:last_updated:observation_start:observation_end:popularity:group_popularit
:realtime_end(struct of typeDate) - End of the real-time period.:realtime_start(struct of typeDate) - Start of the real-time period.:search_type(atom/0) - Tag group filter. Supported values are::full_text- Searches title, units, frequency, and tags:series_id- Substring search on series IDs
:sort_order(atom/0) - The sort order of the results. Supported values are::asc:desc
:tag_names(list ofString.t/0) - List of tag names to match.
Examples
iex> {:ok, series} = Fred.Series.search("UNRATE", search_type: :series_id)
iex> %{"seriess" => [_ | _]} = series
iex> {:ok, series} =
...> Fred.Series.search("unemployment rate",
...> order_by: :popularity,
...> sort_order: :desc,
...> limit: 10
...> )
iex> %{"seriess" => [_ | _]} = series
iex> {:error, %Fred.Error{type: :option_error}} =
...> Fred.Series.search("UNRATE", search_type: "Bad search type")
@spec search_tags(search_text :: String.t(), opts :: keyword()) :: Fred.Client.response()
Get the tags for a series search.
Returns the FRED tags that are assigned to series matching the search text.
Options
:limit(pos_integer/0) - Max results (between 1-1000).:offset(pos_integer/0) - Result offset.:order_by(atom/0) - Order the results by the provided field. Supported values are::series_count:popularity:created:name:group_id
:realtime_end(struct of typeDate) - End of the real-time period.:realtime_start(struct of typeDate) - Start of the real-time period.:sort_order(atom/0) - The sort order of the results. Supported values are::asc:desc
:tag_group_id(atom/0) - Tag group filter. Supported values are::freq- Frequency:gen- General or Concept:geo- Geography:geot- Geography Type:rls- Release:seas- Seasonal Adjustment:src- Source
:tag_names(list ofString.t/0) - List of tag names to match.:tag_search_text(String.t/0) - Text to search tag names
Examples
iex> {:ok, tags} = Fred.Series.search_tags("monetary service index")
iex> %{"tags" => [_ | _]} = tags
iex> {:error, %Fred.Error{type: :option_error}} =
...> Fred.Series.search_tags("monetary service index", realtime_start: "Bad Input")
@spec tags(series_id :: String.t(), opts :: keyword()) :: Fred.Client.response()
Get the FRED tags for an economic data series.
Options
:order_by(atom/0) - Order the results by the provided field. Supported values are:
:series_count:popularity:created:name:group_id
:realtime_end(struct of typeDate) - End of the real-time period.:realtime_start(struct of typeDate) - Start of the real-time period.:sort_order(atom/0) - The sort order of the results. Supported values are::asc:desc
Examples
iex> {:ok, tags} = Fred.Series.tags("UNRATE")
iex> %{"tags" => [_ | _]} = tags
iex> {:error, %Fred.Error{type: :option_error}} =
...> Fred.Series.tags("UNRATE", realtime_start: "Bad Input")
@spec updates(opts :: keyword()) :: Fred.Client.response()
Get economic data series sorted by when observations were updated on the FRED server.
Results are limited to series updated within the last two weeks.
Options
:end_time(struct of typeNaiveDateTime) - End time for filtering updates.:filter_value(atom/0) - Tag group filter. Supported values are::macro:regional:all
:limit(pos_integer/0) - Max results (between 1-1000).:offset(pos_integer/0) - Result offset.:realtime_end(struct of typeDate) - End of the real-time period.:realtime_start(struct of typeDate) - Start of the real-time period.:sort_order(atom/0) - The sort order of the results. Supported values are::asc:desc
:start_time(struct of typeNaiveDateTime) - Start time for filtering updates.
Examples
iex> {:ok, series} = Fred.Series.updates(limit: 20, filter_value: :macro)
iex> %{"seriess" => [_ | _]} = series
iex> {:error, %Fred.Error{type: :option_error}} =
...> Fred.Series.updates(realtime_start: "Bad Input")
@spec vintage_dates(series_id :: String.t(), opts :: keyword()) :: Fred.Client.response()
Get 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.
Options
:limit(pos_integer/0) - Max results (between 1-10000).:offset(pos_integer/0) - Result offset.:realtime_end(struct of typeDate) - End of the real-time period.:realtime_start(struct of typeDate) - Start of the real-time period.:sort_order(atom/0) - The sort order of the results. Supported values are::asc:desc
Examples
iex> {:ok, vintage_dates} = Fred.Series.vintage_dates("GDP")
iex> %{"vintage_dates" => [_ | _]} = vintage_dates
iex> {:error, %Fred.Error{type: :option_error}} =
...> Fred.Series.vintage_dates("GDP", realtime_start: "Bad Input")