quandl

package
v0.0.0-...-b4a56e0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2014 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Example
x, _ := GetData("BOE/XUDLBK73", "2013-01-01", "2013-01-05")
x.ToDate = "2014-05-22"
fmt.Printf("%s\n", x)
Output:

&{BOE Bank of England XUDLBK73 daily 2005-04-01 2014-05-22 [Date Value] [[2013-01-04 %!s(float64=6.2303)] [2013-01-03 %!s(float64=6.2301)] [2013-01-02 %!s(float64=6.2301)]]}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllSecurityList

func GetAllSecurityList() ([]string, []string)

GetAllSecurityList gets all the security identifiers and descriptions

Example
identifier, description := GetAllSecurityList()

fmt.Printf("len(identifier)=%v\n%q : %q\n", len(identifier), identifier[20000], description[20000])
Output:

len(identifier)=21382
"GOOG/NYSEARCA_TDTT" : "TDTT"

func GetBitcoinList

func GetBitcoinList() ([]string, []string)

GetBitcoinList just returns http://www.quandl.com/api/v1/datasets/BITCOIN/BITSTAMPUSD

func GetCommoditiesList

func GetCommoditiesList() ([]string, []string)

GetCommoditiesList gets all the Quandl codes and commodity descriptions

func GetDowConstituents

func GetDowConstituents() ([]string, []string)

GetDowConstituents

func GetETFList

func GetETFList() ([]string, []string)

GetETFList gets all the Quandl codes and ETF descriptions

func GetETFTickerList

func GetETFTickerList() ([]string, []string)

GetETFTickerList gets all the Quandl codes and ETF tickers

func GetEconomicDataList

func GetEconomicDataList() ([]string, []string)

Economic data (doesn't pertain to a particular security) GetEconomicDataList

Example
identifier, description := GetEconomicDataList()

fmt.Printf("%q : %q\n", identifier[0], description[0])
Output:

"FRED/LAWFIN" : "Finance and Insurance Wages and Salaries in Louisiana"

func GetFTSE100Constituents

func GetFTSE100Constituents() ([]string, []string)

GetFTSE100Constituents

func GetFinancialRatiosList

func GetFinancialRatiosList() ([]string, []string)

GetFinancialRatiosList returns the list of Damordoran financial ratios. Currently this list is hard-coded into the file because Quandl does not provide a file from where to read. A caveat about using these is that you need to append the ticker in a particular way to use these ratios

Example
identifier, description := GetFinancialRatiosList()

fmt.Printf("%q : %q\n", identifier[10], description[10])
Output:

"PE_FWD" : "Forward PE Ratio"

func GetNasdaq100Constituents

func GetNasdaq100Constituents() ([]string, []string)

GetNasdaq100Constituents

func GetNasdaqCompositeConstituents

func GetNasdaqCompositeConstituents() ([]string, []string)

GetNasdaqCompositeConstituents

func GetSP500Constituents

func GetSP500Constituents() ([]string, []string)

Index membership GetSP500Constituents

Example
identifier, description := GetSP500Constituents()

fmt.Printf("len(identifer)=%v\n", len(identifier))
fmt.Printf("len(description)=%v\n", len(description))
//fmt.Printf("%q : %q\n", identifier[0], description[0])
Output:

len(identifer)=500
len(description)=500

func GetSP500SectorMappings

func GetSP500SectorMappings() ([]string, []string)

Sector mappings GetSP500SectorMappings

Example
identifier, description := GetSP500SectorMappings()

fmt.Printf("len(identifer)=%v\n", len(identifier))
fmt.Printf("len(description)=%v\n", len(description))
//fmt.Printf("%q : %q\n", identifier[0], description[0])
Output:

len(identifer)=500
len(description)=500

func GetStockIndexList

func GetStockIndexList() ([]string, []string)

GetStockIndexList gets all the Quandl codes and stock index descriptions

func GetStockList

func GetStockList() ([]string, []string)

GetStockList gets all the Quandl stock codes and descriptions

Example
identifier, description := GetStockList()

fmt.Printf("%q : %q\n", identifier[0], description[0])
Output:

"WIKI/ACT" : "Actavis, Inc."

func GetStockTickerList

func GetStockTickerList() ([]string, []string)

GetStockTickerList gets all the Quandl codes and tickers

func Search(query string) ([]byte, error)

Search executes a query against the Quandl API and returns the JSON object as a byte stream. In future releases of this Go (golang) Quandl package this will return a native object instead of the json

func SetAuthToken

func SetAuthToken(token string)

SetAuthToken sets the auth token globally so that all subsequent calls that retrieve data from the Quandl API will use the auth token.

Example
SetAuthToken("")

x, _ := GetData("WIKI/AAPL", "2013-01-01", "2013-01-05")
x.ToDate = "2014-05-22"
fmt.Printf("%s\n", x)
Output:

&{WIKI Quandl Open Data AAPL daily 1980-12-12 2014-05-22 [Date Open High Low Close Volume Ex-Dividend Split Ratio Adj. Open Adj. High Adj. Low Adj. Close Adj. Volume] [[2013-01-04 %!s(float64=536.97) %!s(float64=538.63) %!s(float64=525.83) %!s(float64=527) %!s(float64=2.12262e+07) %!s(float64=0) %!s(float64=1) %!s(float64=73.613294063499) %!s(float64=73.840863700808) %!s(float64=72.086109870961) %!s(float64=72.24650533822) %!s(float64=1.485834e+08)] [2013-01-03 %!s(float64=547.88) %!s(float64=549.67) %!s(float64=541) %!s(float64=542.1) %!s(float64=1.26059e+07) %!s(float64=0) %!s(float64=1) %!s(float64=75.108947523158) %!s(float64=75.354338879051) %!s(float64=74.165767339615) %!s(float64=74.316566496868) %!s(float64=8.82413e+07)] [2013-01-02 %!s(float64=553.82) %!s(float64=555) %!s(float64=541.63) %!s(float64=549.03) %!s(float64=2.00185e+07) %!s(float64=0) %!s(float64=1) %!s(float64=75.923262972321) %!s(float64=76.08502934101) %!s(float64=74.252134129678) %!s(float64=75.266601187558) %!s(float64=1.401295e+08)]]}

Types

type QuandlResponse

type QuandlResponse struct {
	SourceCode string      `json:"source_code"`
	SourceName string      `json:"source_name"`
	Code       string      `json:"code"`
	Frequency  string      `json:"frequency"`
	FromDate   string      `json:"from_date"`
	ToDate     string      `json:"to_date"`
	Columns    []string    `json:"column_names"`
	Data       interface{} `json:"data"`
}

func GetAllHistory

func GetAllHistory(identifier string) (*QuandlResponse, error)

GetAllHistory is similar to GetData except that it does not restrict a date range

Example
x, _ := GetAllHistory("DMDRN/MSFT_MKT_CAP")
fmt.Printf("%s\n", x)
Output:

&{DMDRN Damodaran Financial Data MSFT_MKT_CAP annual 2000-06-30 2013-06-30 [Date Market Capitalization] [[2013-06-30 %!s(float64=312297.5)] [2012-06-30 %!s(float64=227057.1)] [2011-06-30 %!s(float64=217062.1)] [2010-06-30 %!s(float64=241362.8)] [2009-06-30 %!s(float64=275188)] [2008-06-30 %!s(float64=172089.1)] [2007-06-30 %!s(float64=336499.4)] [2006-06-30 %!s(float64=294403.6)] [2005-06-30 %!s(float64=280921.5)] [2004-06-30 %!s(float64=292811.8)] [2003-06-30 %!s(float64=293355.8)] [2002-06-30 %!s(float64=300819.4)] [2001-06-30 %!s(float64=364524.4)] [2000-06-30 %!s(float64=281947.4)]]}

func GetData

func GetData(identifier string, startDate string, endDate string) (*QuandlResponse, error)

GetData gets Quandl data for a particular identifier and a date range. You can optionally set the auth token before running this function so that you can make unlimited API calls instead of being limited to 500/day.

func (*QuandlResponse) GetTimeSeries

func (q *QuandlResponse) GetTimeSeries(column string) ([]string, []float64)

GetTimeSeries returns a date vector and the value vector for a particular column in the QuandlResponse

func (*QuandlResponse) GetTimeSeriesColumn

func (q *QuandlResponse) GetTimeSeriesColumn(column string) []float64

GetTimeSeriesColumn returns the data from the Quandl response for a particular column. For some series, particularly stock data, multiple columns are returned. Using this method you can specify the specific column to extract.

func (*QuandlResponse) GetTimeSeriesData

func (q *QuandlResponse) GetTimeSeriesData() ([]float64, string)

GetTimeSeriesData returns the most relevant data column from the Quandl response. In many cases you will not necessarily know beforehand what type of data is being requested and therefore cannot determine if it's stock data vs. economic data. In such cases, you can use this function to grab the column that is most likely relevant. The method also returns the most relevant

func (*QuandlResponse) GetTimeSeriesDate

func (q *QuandlResponse) GetTimeSeriesDate() []string

GetTimeSeriesDate returns the series of dates in the time series

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL