API Reference


A connection to the Fred API.


  • Fred(): Key detected automatically. First, looks for the environment variable FRED_API_KEY, then looks for the file ~/.freddatarc.
  • Fred(key::AbstractString): User specifies key directly


  • key: Registration key provided by FRED.


  • Set the API url with set_api_url!(f::Fred, url::AbstractString)

Represent a single data series, and all associated metadata, as queried from FRED.

The following fields are available:

  • id: Series ID
  • title: Series title
  • units_short: Units (abbr.)
  • units: Units
  • seas_adj_short: Seasonal adjustment (abbr.)
  • seas_adj:Seasonal adjustment
  • freq_short:Native frequency (abbr.)
  • freq:Native frequency
  • realtime_start:Date realtime period starts
  • realtime_end:Date realtime period ends
  • last_updated:Date series last updated
  • notes:Series notes
  • trans_short:Transformation of queried data (abbr.)
  • data:The actual data; DataFrame with columns :realtime_start, :realtime_end, :date, :value
get_data(f::Fred, series::AbstractString; kwargs...)

Request one series using the FRED API.


  • f: Fred connection object
  • series: series mnemonic

Optional Arguments

kwargs...: key-value pairs to be appended to the FRED request. Accepted keys include:

  • realtime_start: the start of the real-time period as YYYY-MM-DD string
  • realtime_end: the end of the real-time period as YYYY-MM-DD string
  • limit: maximum number of results to return
  • offset: non-negative integer
  • sort_order: "asc", "desc"
  • observation_start: the start of the observation period as YYYY-MM-DD string
  • observation_end: the end of the observation period as YYYY-MM-DD string
  • units: one of "lin", "chg", "ch1", "pch", "pc1", "pca", "cch", "cca", "log"
  • frequency: one of "d", "w", "bw", "m", "q", "sa", "a", "wef", "weth", "wew", "wetu", "wem", "wesu", "wesa", "bwew", "bwem"
  • aggregation_method: one of "avg", "sum", "eop"
  • output_type: one of 1 (obsevations by real-time period), 2 (observations by vintage date, all observations), 3 (observations by vintage date, new and revised observations only), 4 (observations, initial release only)
  • vintage_dates: vintage dates as comma-separated YYYY-MM-DD strings