Beispiel #1
0
func ExampleTimeColumn() {
	quandl.ApiKey = apiKey
	quandl.CacheHandler = filecache.Handler{Life: 60}

	opts := quandl.NewOptions(
		"trim_start", "2014-01-01",
		"trim_end", "2014-01-06",
		"column", "4",
	)

	data, err := quandl.GetSymbol("WIKI/AAPL", opts)
	if err != nil {
		panic(err)
	}

	columns := data.ToColumns()
	var dates []time.Time = quandl.TimeColumn(columns[0])
	fmt.Println(dates)

	// Output:
	// [2014-01-06 00:00:00 +0000 UTC 2014-01-03 00:00:00 +0000 UTC 2014-01-02 00:00:00 +0000 UTC]
}
Beispiel #2
0
func ExampleNewOptions() {
	quandl.ApiKey = apiKey
	quandl.CacheHandler = filecache.Handler{Life: 60}

	opts := quandl.NewOptions(
		"trim_start", "2014-01-01",
		"trim_end", "2014-01-06",
		"column", "4",
	)

	data, err := quandl.GetSymbolRaw("WIKI/AAPL", "csv", opts)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(data))

	// Output:
	// Date,Close
	// 2014-01-06,543.93
	// 2014-01-03,540.98
	// 2014-01-02,553.13
}
Beispiel #3
0
func ExampleFloatColumn() {
	quandl.ApiKey = apiKey
	quandl.CacheHandler = filecache.Handler{Life: 60}

	opts := quandl.NewOptions(
		"trim_start", "2014-01-01",
		"trim_end", "2014-01-06",
		"column", "4",
	)

	data, err := quandl.GetSymbol("WIKI/AAPL", opts)
	if err != nil {
		panic(err)
	}

	columns := data.ToColumns()
	var prices []float64 = quandl.FloatColumn(columns[1])
	fmt.Println(prices)

	// Output:
	// [543.93 540.98 553.13]
}