GoLang Client for Federal Reserve Economic Data
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml
LICENSE.md
README.md
categories_toolkit_v1.go
categories_toolkit_v1_test.go
constants.go
fred_go_toolkit.go
fred_toolkit_v1.go
fred_toolkit_v1_test.go
params.go
releases_toolkit_v1.go
releases_toolkit_v1_test.go
series_toolkit_v1.go
series_toolkit_v1_test.go
sources_toolkit_v1.go
sources_toolkit_v1_test.go
tag_toolkit_v1.go
tag_toolkit_v1_test.go
unused_structs.go

README.md

fred_go_toolkit

FRED GoLang Toolkit for Federal Reserve Economic Data

Build Status

GoDoc

This is a GoLang toolkit for working with 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.

Installation

Setup Go environment. Run 'go get github.com/nswekosk/fred_go_toolkit'

Get a FRED API key

Sign up for a Fred API key: http://api.stlouisfed.org/api_key.html

Usage Example

fredConfig := FredConfig{ APIKey: 'api-key', FileType: FileTypeJSON,
LogFile: "log.log", }

client := CreateFredClient(fredConfig)

File types and log files are optional. You can use local constants 'FileTypeJSON' ('json')     
or 'FileTypeXML' ('xml'). If no file type is specified, the default type is XML. 

params := make(map[string]interface{})

These will be your input parameters for the API call. The value is of 
type interface{} because it can take int's, string's, or booleans.    
Each will be converted to string format for the url.                  

params["category_id"] = 125

url: 'https://api.stlouisfed.org/fred/category?category_id=125&api_key=apiKey&file_type=json' 

fc, err := client.GetRecord(params)

fc is of type FredClient. This contains all necessary attributes for all 
responses for the available API calls.                                   

if err != nil { fmt.Println(err) }

NOTE: Logging is automatically generated once you run the client. The log  
file will be created in the directory in which the client is instantiated.