Fred.Releases (Fred v0.4.0)

Copy Markdown View Source

Functions for the FRED Releases endpoints.

Releases are publications of economic data. For example, the "Employment Situation" release includes the unemployment rate, nonfarm payrolls, and other labor market series.

Endpoints

Summary

Functions

Get release dates for all releases of economic data.

Get a release of economic data.

Get all releases of economic data.

Get the related FRED tags for a release.

Get release dates for a specific release of economic data.

Get the series on a release of economic data.

Get the sources for a release of economic data.

Get the release tables for a given release.

Get the FRED tags for a release.

Functions

dates(opts \\ [])

@spec dates(keyword()) :: Fred.Client.response()

Get release dates for all releases of economic data.

Note that release dates are published by data sources and do not necessarily represent when data was available via the FRED API.

Options

  • :filter_value (String.t/0) - The value of the filter_variable attribute to filter results by. This requires that the :filter_variable is 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:

    • :release_date
    • :release_id
    • :release_name
  • :realtime_end (struct of type Date) - End of the real-time period.

  • :realtime_start (struct of type Date) - Start of the real-time period.

  • :sort_order (atom/0) - The sort order of the results. Supported values are:

    • :asc
    • :desc
  • :tag_names (boolean/0) - Include future release dates with no data yet

Examples

iex> {:ok, release_dates} = Fred.Releases.dates(
...>   limit: 10,
...>   order_by: :release_date,
...>   sort_order: :desc
...> )
iex> %{"release_dates" => [_ | _]} = release_dates

iex> {:error, %Fred.Error{type: :option_error}} =
...>   Fred.Releases.dates(realtime_start: "Bad Input")

get(release_id, opts \\ [])

@spec get(release_id :: integer(), opts :: keyword()) :: Fred.Client.response()

Get a release of economic data.

Options

  • :realtime_end (struct of type Date) - End of the real-time period.

  • :realtime_start (struct of type Date) - Start of the real-time period.

Examples

iex> {:ok, releases} = Fred.Releases.get(53)
iex> %{"releases" => [_ | _]} = releases

iex> {:error, %Fred.Error{type: :option_error}} =
...>   Fred.Releases.get(53, realtime_start: "Bad Input")

list(opts \\ [])

@spec list(keyword()) :: Fred.Client.response()

Get all releases of economic data.

Options

  • :filter_value (String.t/0) - The value of the filter_variable attribute to filter results by. This requires that the :filter_variable is 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:

    • :release_id
    • :name
    • :press_release
    • :realtime_start
    • :realtime_end
  • :realtime_end (struct of type Date) - End of the real-time period.

  • :realtime_start (struct of type Date) - Start of the real-time period.

  • :sort_order (atom/0) - The sort order of the results. Supported values are:

    • :asc
    • :desc

Examples

iex> {:ok, releases} = Fred.Releases.list(limit: 20, order_by: :name)
iex> %{"releases" => [_ | _]} = releases

iex> {:error, %Fred.Error{type: :option_error}} =
...>   Fred.Releases.list(limit: 20, realtime_start: "Bad Input")

release_dates(release_id, opts \\ [])

@spec release_dates(release_id :: integer(), opts :: keyword()) ::
  Fred.Client.response()

Get release dates for a specific release of economic data.

Options

  • :limit (pos_integer/0) - Max results (between 1-10000).

  • :offset (pos_integer/0) - Result offset.

  • :realtime_end (struct of type Date) - End of the real-time period.

  • :realtime_start (struct of type Date) - Start of the real-time period.

  • :sort_order (atom/0) - The sort order of the results. Supported values are:

    • :asc
    • :desc
  • :tag_names (boolean/0) - Include future release dates with no data yet

Examples

iex> {:ok, release_dates} = Fred.Releases.release_dates(53, sort_order: :desc, limit: 5)
iex> %{"release_dates" => [_ | _]} = release_dates

iex> {:error, %Fred.Error{type: :option_error}} =
...>   Fred.Releases.release_dates(53, realtime_start: "Bad Input")

series(release_id, opts \\ [])

@spec series(release_id :: integer(), opts :: keyword()) :: Fred.Client.response()

Get the series on a release of economic data.

Options

  • :exclude_tag_names (list of String.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_variable is 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:

    • :series_id
    • :title
    • :units
    • :frequency
    • :seasonal_adjustment
    • :realtime_start
    • :realtime_end
    • :last_updated
    • :observation_start
    • :observation_end
    • :popularity
    • :group_popularity
  • :realtime_end (struct of type Date) - End of the real-time period.

  • :realtime_start (struct of type Date) - Start of the real-time period.

  • :sort_order (atom/0) - The sort order of the results. Supported values are:

    • :asc
    • :desc
  • :tag_names (list of String.t/0) - List of tag names to match.

Examples

iex> {:ok, release_series} = Fred.Releases.series(50, order_by: :popularity, sort_order: :desc)
iex> %{"seriess" => [_ | _]} = release_series

iex> {:error, %Fred.Error{type: :option_error}} =
...>   Fred.Releases.series(50, order_by: :bad_input, sort_order: :up_down_sideways)

sources(release_id, opts \\ [])

@spec sources(release_id :: integer(), opts :: keyword()) :: Fred.Client.response()

Get the sources for a release of economic data.

Options

  • :realtime_end (struct of type Date) - End of the real-time period.

  • :realtime_start (struct of type Date) - Start of the real-time period.

Examples

iex> {:ok, release_series} = Fred.Releases.sources(50)
iex> %{"sources" => [_ | _]} = release_series

iex> {:error, %Fred.Error{type: :option_error}} =
...>   Fred.Releases.sources(50, realtime_start: "Bad Input")

tables(release_id, opts \\ [])

@spec tables(release_id :: integer(), opts :: keyword()) :: Fred.Client.response()

Get the release tables for a given release.

Options

  • :element_id (pos_integer/0) - The release table element ID to retrieve

  • :include_observation_values (boolean/0) - A flag to indicate that observations need to be returned. Observation value and date will only be returned for a series type element.

  • :observation_date (struct of type Date) - The observation date.

Examples

iex> {:ok, release_tables} = Fred.Releases.tables(53)
iex> %{"release_id" => "53", "elements" => _} = release_tables

iex> {:error, %Fred.Error{type: :option_error}} =
...>   Fred.Releases.tables(53, realtime_start: "Bad Input")

tags(release_id, opts \\ [])

@spec tags(release_id :: integer(), opts :: keyword()) :: Fred.Client.response()

Get the FRED tags for a release.

Options

  • :limit (pos_integer/0) - Max results (between 1-10000).

  • :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 type Date) - End of the real-time period.

  • :realtime_start (struct of type Date) - Start of the real-time period.

  • :search_text (String.t/0) - Text to search tag names.

  • :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 of String.t/0) - List of tag names to match.

Examples

iex> {:ok, release_tags} = Fred.Releases.tags(50, tag_group_id: :gen)
iex> %{"tags" => [_ | _]} = release_tags

iex> {:error, %Fred.Error{type: :option_error}} =
...>   Fred.Releases.tags(50, realtime_start: "Bad Input" )