quandl

package
v0.0.0-...-8c3ffa5 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package quandl provides low-level access to the www.qunadl.com web service. It it designed to cover features available to non-paying registred users.

Index

Constants

View Source
const Layout string = "2006-01-02"

Layout used to format time to/from strings.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frequency

type Frequency string

Frequency of the samples.

const (
	Daily     Frequency = "daily"
	Weekly    Frequency = "weekly"
	Monthly   Frequency = "montly"
	Quarterly Frequency = "quarterly"
	Annual    Frequency = "annual"
)

Frequency constants.

type Q

type Q struct {
	// contains filtered or unexported fields
}

Q is the QUANDL query structure. It is thread safe.

func New

func New(apiKey string, source Source, options ...QOption) *Q

New construct a new Q with the specified options. The source (eg : EURONEXT) is regquired. Existing Q may be used multiple times to query different time series from the same Source.

func (*Q) Version

func (q *Q) Version() string

Version is the api base url used.

func (*Q) WalkDataset

func (q *Q) WalkDataset(
	serie string,
	processor RecordProcessor)

WalkDataset will collect Records from the source/data-serie and process each record with the provided processor.

type QOption

type QOption func(*Q)

A QOption is an option that can be provided when constructing a new Q.

var OptionOrderAsc QOption = func(q *Q) {
	q.query.Set("order", "asc")
}

OptionOrderAsc ascending order.

var OptionOrderDesc QOption = func(q *Q) {
	q.query.Set("order", "desc")
}

OptionOrderDesc descending order.

func OptionEndDate

func OptionEndDate(when time.Time) QOption

OptionEndDate sets the end date.

func OptionFrequency

func OptionFrequency(freq Frequency) QOption

OptionFrequency sets the sampling frequency.

func OptionLimit

func OptionLimit(n int) QOption

OptionLimit sets the number of dataset returned. Set limit to 1 to return the last dataset.

func OptionStartDate

func OptionStartDate(when time.Time) QOption

OptionStartDate sets the start date.

type Record

type Record struct {
	Date    time.Time `gorm:"primary_key"`
	Source  string
	Serie   string `gorm:"primary_key"`
	Measure string `gorm:"primary_key"`

	Value float64 `gorm:"NOT NULL"`
}

Record elementary data structure, as retrieved from a source/serie. This is the format used to communicate to the external world.

func (*Record) String

func (r *Record) String() string

type RecordProcessor

type RecordProcessor func(Record)

RecordProcessor knows how to process a Record

type Source

type Source string

Source represent a source database in QUANDL.

type Transform

type Transform string

A Transform defines transformations to apply to data.

const (
	Delta         Transform = "diff"
	DeltaPercent  Transform = "rdiff"
	CumulativeSum Transform = "cumul"
	Base100       Transform = "normalize"
)

Transform constants.

Jump to

Keyboard shortcuts

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