Documentation
¶
Overview ¶
Package fred_go_toolkit is a GoLang toolkit for retrieving the Federal Reserve Economic Data. FRED contains frequently updated US macro and regional economic time series at annual, quarterly, monthly, weekly, and daily frequencies. FRED aggregates economic data from a variety of sources - most of which are US government agencies. The economic time series in FRED contains observation or measurement periods associated with data values. For instance, the US unemployment rate for the month of January, 1990 was 5.4 percent and for the month of January, 2000 was 4.0 percent.
Index ¶
- Constants
- type Categories
- type Category
- type FredClient
- func (f *FredClient) GetCategory(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetCategoryChildren(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetCategoryRelatedTags(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetCategorySeries(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetCategoryTags(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetRelatedCategory(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetRelatedTags(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetRelease(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetReleaseDates(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetReleaseRelatedTags(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetReleaseSeries(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetReleaseSources(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetReleaseTables(params map[string]interface{}) (string, error)
- func (f *FredClient) GetReleaseTags(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetReleases(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetReleasesDates(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSeries(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSeriesCategories(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSeriesObservations(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSeriesRelease(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSeriesSearch(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSeriesSearchRelatedTags(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSeriesSearchTags(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSeriesTags(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSeriesUpdates(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSeriesVintageDates(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSource(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSourceReleases(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetSources(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetTagSeries(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) GetTags(params map[string]interface{}) (*FredType, error)
- func (f *FredClient) UpdateAPIKEY(APIKey string) error
- type FredConfig
- type FredType
- type Observation
- type Release
- type ReleaseDate
- type Series
- type Source
- type Tag
Constants ¶
const ( FileTypeJSON = "json" FileTypeXML = "xml" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Categories ¶
type Categories struct {
CategoryCol []Category `json:"categories"`
}
Categories represents a collection of FRED categories.
type Category ¶
type Category struct { ID int `json:"id" xml:"id,attr"` Name string `json:"name" xml:"name,attr"` ParentID int `json:"parent_id" xml:"parent_id,attr"` }
Category is a single instance of a FRED category.
type FredClient ¶
type FredClient struct { APIKEY string // contains filtered or unexported fields }
FredClient is the main instance to call the FRED API. All methods are a member of an instance of the FredClient.
func CreateFredClient ¶
func CreateFredClient(config FredConfig) (*FredClient, error)
CreateFredClient creates an instance of a FRED client.
func (*FredClient) GetCategory ¶
func (f *FredClient) GetCategory(params map[string]interface{}) (*FredType, error)
GetCategory will get a category.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/category.html
func (*FredClient) GetCategoryChildren ¶
func (f *FredClient) GetCategoryChildren(params map[string]interface{}) (*FredType, error)
GetCategoryChildren will get the child categories for a specified parent category.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/category_children.html
func (*FredClient) GetCategoryRelatedTags ¶
func (f *FredClient) GetCategoryRelatedTags(params map[string]interface{}) (*FredType, error)
GetCategoryRelatedTags will get the related FRED tags for one or more FRED tags within a category. Optionally, filter results by tag group or search.
FRED tags are attributes assigned to series. For this request, related FRED tags are the tags assigned to series that match all tags in the tag_names parameter, no tags in the exclude_tag_names parameter, and the category set by the category_id parameter. See the related request GetCategoryTags.
Series are assigned tags and categories. Indirectly through series, it is possible to get the tags for a category. No tags exist for a category that does not have series.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/category_related_tags.html
func (*FredClient) GetCategorySeries ¶
func (f *FredClient) GetCategorySeries(params map[string]interface{}) (*FredType, error)
GetCategorySeries will get the series in a category.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/category_series.html
func (*FredClient) GetCategoryTags ¶
func (f *FredClient) GetCategoryTags(params map[string]interface{}) (*FredType, error)
GetCategoryTags will get the FRED tags for a category. Optionally, filter results by tag name, tag group, or search. Series are assigned tags and categories. Indirectly through series, it is possible to get the tags for a category. No tags exist for a category that does not have series. See the related request GetCategoryRelatedTags.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/category_tags.html
func (*FredClient) GetRelatedCategory ¶
func (f *FredClient) GetRelatedCategory(params map[string]interface{}) (*FredType, error)
GetRelatedCategory will get the related categories for a category. A related category is a one-way relation between 2 categories that is not part of a parent-child category hierarchy. Most categories do not have related categories.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/category_related.html
func (*FredClient) GetRelatedTags ¶
func (f *FredClient) GetRelatedTags(params map[string]interface{}) (*FredType, error)
GetRelatedTags will get the related FRED tags for one or more FRED tags. Optionally, filter results by tag group or search.
FRED tags are attributes assigned to series. Related FRED tags are the tags assigned to series that match all tags in the tag_names parameter and no tags in the exclude_tag_names parameter. See the related request GetTags.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/related_tags.html
func (*FredClient) GetRelease ¶
func (f *FredClient) GetRelease(params map[string]interface{}) (*FredType, error)
GetRelease will get a release of economic data.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/release.html
func (*FredClient) GetReleaseDates ¶
func (f *FredClient) GetReleaseDates(params map[string]interface{}) (*FredType, error)
GetReleaseDates will get release dates for a release of economic data. Note that release dates are published by data sources and do not necessarily represent when data will be available on the FRED or ALFRED websites.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/release_dates.html
func (*FredClient) GetReleaseRelatedTags ¶
func (f *FredClient) GetReleaseRelatedTags(params map[string]interface{}) (*FredType, error)
GetReleaseRelatedTags will get the related FRED tags for one or more FRED tags within a release. Optionally, filter results by tag group or search.
FRED tags are attributes assigned to series. For this request, related FRED tags are the tags assigned to series that match all tags in the tag_names parameter, no tags in the exclude_tag_names parameter, and the release set by the release_id parameter. See the related request GetReleaseTags.
Series are assigned tags and releases. Indirectly through series, it is possible to get the tags for a release.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/release_related_tags.html
func (*FredClient) GetReleaseSeries ¶
func (f *FredClient) GetReleaseSeries(params map[string]interface{}) (*FredType, error)
GetReleaseSeries will get the series on a release of economic data.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/release_series.html
func (*FredClient) GetReleaseSources ¶
func (f *FredClient) GetReleaseSources(params map[string]interface{}) (*FredType, error)
GetReleaseSources will get the sources for a Release of economic data.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/release_sources.html
func (*FredClient) GetReleaseTables ¶
func (f *FredClient) GetReleaseTables(params map[string]interface{}) (string, error)
GetReleaseTables will get release table trees for a given release. You can go directly to the tree structure by passing the appropriate ElementId. You may also use a drill-down approach to start at the root (top most) element by leaving the element_id off.
Note that release dates are published by data sources and do not necessarily represent when data will be available on the FRED or ALFRED websites.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/release_tables.html
func (*FredClient) GetReleaseTags ¶
func (f *FredClient) GetReleaseTags(params map[string]interface{}) (*FredType, error)
GetReleaseTags will get the FRED tags for a release. Optionally, filter results by tag name, tag group, or search. Series are assigned tags and releases. Indirectly through series, it is possible to get the tags for a release. See the related request GetReleaseRelatedTags.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/release_tags.html
func (*FredClient) GetReleases ¶
func (f *FredClient) GetReleases(params map[string]interface{}) (*FredType, error)
GetReleases will get all releases of economic data.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/releases.html
func (*FredClient) GetReleasesDates ¶
func (f *FredClient) GetReleasesDates(params map[string]interface{}) (*FredType, error)
GetReleasesDates will 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 will be available on the FRED or ALFRED websites.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/releases_dates.html
func (*FredClient) GetSeries ¶
func (f *FredClient) GetSeries(params map[string]interface{}) (*FredType, error)
GetSeries will get an economic data series.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/series.html
func (*FredClient) GetSeriesCategories ¶
func (f *FredClient) GetSeriesCategories(params map[string]interface{}) (*FredType, error)
GetSeriesCategories will get the categories for an economic data series.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/series_categories.html
func (*FredClient) GetSeriesObservations ¶
func (f *FredClient) GetSeriesObservations(params map[string]interface{}) (*FredType, error)
GetReleaseObservations will get the observations or data values for an economic data series.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/series_observations.html
func (*FredClient) GetSeriesRelease ¶
func (f *FredClient) GetSeriesRelease(params map[string]interface{}) (*FredType, error)
GetSeriesRelease will get the release for an economic data series.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/series_release.html
func (*FredClient) GetSeriesSearch ¶
func (f *FredClient) GetSeriesSearch(params map[string]interface{}) (*FredType, error)
GetSeriesSearch will get economic data series that match keywords.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/series_search.html
func (*FredClient) GetSeriesSearchRelatedTags ¶
func (f *FredClient) GetSeriesSearchRelatedTags(params map[string]interface{}) (*FredType, error)
GetSeriesSearchRelatedTags will get teh related tags for a series search. Optionally, filter results by tag group or tag search.
FRED tags are attributes assigned to series. For this request, related FRED tags are the tags assigned to series that match all tags in the tag_names parameter, no tags in the exclude_tag_names parameter, and the search words set by the series_search_text parameter. See the related request GetSeriesSearchTags.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/series_search_related_tags.html
func (*FredClient) GetSeriesSearchTags ¶
func (f *FredClient) GetSeriesSearchTags(params map[string]interface{}) (*FredType, error)
GetSeriesSearchTags will get the FRED tags for a series search. Optionally, filter results by tag name, tag group, or tag search. See the related request GetSeriesSearchRelatedTags.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/series_search_tags.html
func (*FredClient) GetSeriesTags ¶
func (f *FredClient) GetSeriesTags(params map[string]interface{}) (*FredType, error)
GetSeriesTags will get the tags for an economic data series.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/series_tags.html
func (*FredClient) GetSeriesUpdates ¶
func (f *FredClient) GetSeriesUpdates(params map[string]interface{}) (*FredType, error)
GetSeriesUpdates will get economic data series sorted by when observations were updated on the FRED® server (attribute last_updated). Results are limited to series updated within the last two weeks.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/series_updates.html
func (*FredClient) GetSeriesVintageDates ¶
func (f *FredClient) GetSeriesVintageDates(params map[string]interface{}) (*FredType, error)
GetSeriesVintageDates will 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.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/series_vintagedates.html
func (*FredClient) GetSource ¶
func (f *FredClient) GetSource(params map[string]interface{}) (*FredType, error)
GetSource will get a source of economic data.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/source.html
func (*FredClient) GetSourceReleases ¶
func (f *FredClient) GetSourceReleases(params map[string]interface{}) (*FredType, error)
GetSourceReleases will get the releases for a source.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/source_releases.html
func (*FredClient) GetSources ¶
func (f *FredClient) GetSources(params map[string]interface{}) (*FredType, error)
GetSources will get all sources of economic data.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/sources.html
func (*FredClient) GetTagSeries ¶
func (f *FredClient) GetTagSeries(params map[string]interface{}) (*FredType, error)
GetTagSeries will get the series matching all tags in the tag_names parameter and no tags in the exclude_tag_names parameter.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/tags_series.html
func (*FredClient) GetTags ¶
func (f *FredClient) GetTags(params map[string]interface{}) (*FredType, error)
GetTags will get FRED tags. Optionally, filter results by tag name, tag group, or search. FRED tags are attributes assigned to series. See the related request GetRelatedTags.
Schema for the request and response objects and source for the documentation can be found at the following link: https://research.stlouisfed.org/docs/api/fred/tags.html
func (*FredClient) UpdateAPIKEY ¶
func (f *FredClient) UpdateAPIKEY(APIKey string) error
UpdateAPIKEY updates the API KEY for the client.
type FredConfig ¶
FredConfig contains the necessary configuration for using the FredClient. Requests can return either XML or JSON by setting the FileType parameter to xml or json. Note that the default value of FileType is xml. The FredClient will only log to a local log file at the moment. This log file is set using the LogFile variable. An APIKey can be retrieved at the following link: https://research.stlouisfed.org/docs/api/api_key.html
type FredType ¶
type FredType struct { Start string `json:"realtime_start" xml:"realtime_start"` End string `json:"realtime_end" xml:"realtime_end"` ObsStart string `json:"observation_start" xml:"observation_start"` ObsEnd string `json:"observation_end" xml:"observation_end"` Units string `json:"units" xml:"units"` OutputType int `json:"output_type" xml:"output_type"` FileType string `json:"file_type" xml:"file_type"` OrderBy string `json:"order_by" xml:"order_by"` SortOrder string `json:"sort_order" xml:"sort_order"` Count int `json:"count" xml:"count"` Offset int `json:"offset" xml:"offset"` Limit int `json:"limit" xml:"limit"` Categories []Category `json:"categories" xml:"category"` Releases []Release `json:"releases" xml:"release"` Seriess []Series `json:"seriess" xml:"series"` Observations []Observation `json:"observations" xml:"observation"` VintageDates []string `json:"vintage_dates" xml:"vintage_date"` Tags []Tag `json:"tags" xml:"tag"` Sources []Source `json:"sources" xml:"source"` ReleaseDates []ReleaseDate `json:"release_dates" xml:"release_date"` }
FredType represents the response object for all responses from the FRED api.
type Observation ¶
type Observation struct { Start string `json:"realtime_start" xml:"realtime_start,attr"` End string `json:"realtime_end" xml:"realtime_end,attr"` Date string `json:"date" xml:"date,attr"` Value string `json:"value" xml:"value,attr"` }
Observation is a single instance of a FRED observation.
type Release ¶
type Release struct { ID int `json:"id" xml:"id,attr"` Start string `json:"realtime_start" xml:"realtime_start,attr"` End string `json:"realtime_end" xml:"realtime_end,attr"` Name string `json:"name" xml:"name,attr"` PressRelease bool `json:"press_release" xml:"press_release,attr"` Link string `json:"link" xml:"link,attr"` Notes string `json:"notes" xml:"notes,attr"` }
Release is a single instance of a release of FRED economic data.
type ReleaseDate ¶
type ReleaseDate struct { ID int `json:"release_id" xml:"release_id,attr"` Name string `json:"release_name" xml:"release_name,attr"` Date string `json:"date" xml:",chardata"` }
ReleaseDate is a single instance of a release date of FRED economic data.
type Series ¶
type Series struct { ID string `json:"id" xml:"id,attr"` Start string `json:"realtime_start" xml:"realtime_start,attr"` End string `json:"realtime_end" xml:"realtime_end,attr"` Title string `json:"title" xml:"title,attr"` ObsStart string `json:"observation_start" xml:"observation_start,attr"` ObsEnd string `json:"observation_end" xml:"observation_end,attr"` Frequency string `json:"annual" xml:"annual,attr"` FrequencyShort string `json:"frequency_short" xml:"frequency_short,attr"` Units string `json:"units" xml:"units,attr"` UnitsShort string `json:"units_short" xml:"units_short,attr"` SeasonalAdjustment string `json:"seasonal_adjustment" xml:"seasonal_adjustment,attr"` SeasonalAdjustmentShort string `json:"seasonal_adjustment_short" xml:"seasonal_adjustment_short,attr"` LastUpdated string `json:"last_updated" xml:"last_updated,attr"` Popularity int `json:"popularity" xml:"popularity,attr"` GroupPopularity int `json:"group_popularity" xml:"group_popularity,attr"` Notes string `json:"notes" xml:"notes,attr"` }
Series is a single instance of a FRED series.
type Source ¶
type Source struct { ID int `json:"id" xml:"id,attr"` Start string `json:"realtime_start" xml:"realtime_start,attr"` End string `json:"realtime_end" xml:"realtime_end,attr"` Name string `json:"name" xml:"name,attr"` Link string `json:"link" xml:"link,attr"` }
Source is a single instance of a FRED Source.
type Tag ¶
type Tag struct { Name string `json:"name" xml:"name,attr"` GroupID string `json:"group_id" xml:"group_id,attr"` Notes string `json:"notes" xml:"notes,attr"` Created string `json:"created" xml:"created,attr"` Popularity int `json:"popularity" xml:"popularity,attr"` SeriesCount int `json:"series_count" xml:"series_count,attr"` }
Tag is a single instance of a FRED tag.