API Reference
FredData.Fred
FredData.FredSeries
FredData.get_api_key
FredData.get_api_url
FredData.get_data
FredData.set_api_url!
FredData.Fred
— TypeA connection to the Fred API.
Constructors
Fred()
: Key detected automatically. First, looks for the environment variableFRED_API_KEY
, then looks for the file~/.freddatarc
.Fred(key::AbstractString)
: User specifies key directly
Arguments
key
: Registration key provided by FRED.
Notes
- Set the API url with
set_api_url!(f::Fred, url::AbstractString)
FredData.FredSeries
— TypeFredSeries(...)
Represent a single data series, and all associated metadata, as queried from FRED.
The following fields are available:
id
: Series IDtitle
: Series titleunits_short
: Units (abbr.)units
: Unitsseas_adj_short
: Seasonal adjustment (abbr.)seas_adj
:Seasonal adjustmentfreq_short
:Native frequency (abbr.)freq
:Native frequencyrealtime_start
:Date realtime period startsrealtime_end
:Date realtime period endslast_updated
:Date series last updatednotes
:Series notestrans_short
:Transformation of queried data (abbr.)data
:The actual data; DataFrame with columns:realtime_start
,:realtime_end
,:date
,:value
FredData.get_api_key
— MethodGet the FRED API key that is used for this connection
FredData.get_api_url
— MethodGet the base URL used to connect to the FRED server
FredData.get_data
— Methodget_data(f::Fred, series::AbstractString; kwargs...)
Request one series using the FRED API.
Arguments
f
: Fred connection objectseries
: 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 stringrealtime_end
: the end of the real-time period as YYYY-MM-DD stringlimit
: maximum number of results to returnoffset
: non-negative integersort_order
:"asc"
,"desc"
observation_start
: the start of the observation period as YYYY-MM-DD stringobservation_end
: the end of the observation period as YYYY-MM-DD stringunits
: 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 of1
(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
FredData.set_api_url!
— MethodSet the base URL used to connect to the FRED server