fquery

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2014 License: AGPL-3.0 Imports: 3 Imported by: 32

Documentation

Index

Constants

View Source
const (
	ErrTplNotSupported = "source '%s' does not support action '%s'"
)

Variables

This section is empty.

Functions

func QuotesToMap

func QuotesToMap(quotes []Quote) map[string]*Quote

Types

type Cache

type Cache interface {
	Source

	SetQuoteExpiry(dur time.Duration)

	HasQuote(symbol string) bool
	HasHist(symbol string, start *time.Time, end *time.Time) bool
}

type DividendEntry

type DividendEntry struct {
	Date      util.YearMonthDay
	Dividends float64 `json:",string"`
}

type DividendHist

type DividendHist struct {
	Symbol    string
	Dividends []DividendEntry
}

type Hist

type Hist struct {
	Symbol  string
	From    time.Time
	To      time.Time
	Entries []HistEntry
}

type HistEntry

type HistEntry struct {
	Date     util.YearMonthDay `json:"Date"`
	Open     float64           `json:"Open,string"`
	Close    float64           `json:"Close,string"`
	AdjClose float64           `json:"AdjClose,string"`
	High     float64           `json:"High,string"`
	Low      float64           `json:"Low,string"`
	Volume   int64             `json:"Volume,string"`
}

type Quote

type Quote struct {
	Symbol   string /* e.g.: VEUR.AS, Vanguard dev. europe on Amsterdam */
	Name     string
	Exchange string

	/* last actualization of the results */
	Updated time.Time

	/* volume */
	Volume         int64 /* outstanding shares */
	AvgDailyVolume int64 /* avg amount of shares traded */

	/* dividend & related */
	PeRatio          float64   /* Price / EPS */
	EarningsPerShare float64   /* (net income - spec.dividends) / avg.  outstanding shares */
	DividendPerShare float64   /* total (non-special) dividend payout / total amount of shares */
	DividendYield    float64   /* annual div. per share / price per share */
	DividendExDate   time.Time /* last dividend payout date */

	/* price & derived */
	Bid, Ask              float64
	Open, PreviousClose   float64
	LastTradePrice        float64
	Change, ChangePercent float64

	DayLow, DayHigh   float64
	YearLow, YearHigh float64

	Ma50, Ma200 float64 /* 200- and 50-day moving average */
}

func (*Quote) DivPayoutRatio

func (q *Quote) DivPayoutRatio() float64

will try to calculate the dividend payout ratio, if possible, * otherwise returns 0

type Source

type Source interface {
	Quote(symbols []string) ([]Quote, error)

	Hist(symbols []string) (map[string]Hist, error)
	HistLimit(symbols []string, start time.Time, end time.Time) (map[string]Hist, error)

	DividendHist(symbols []string) (map[string]DividendHist, error)
	DividendHistLimit(symbols []string, start time.Time, end time.Time) (map[string]DividendHist, error)

	fmt.Stringer
}

Jump to

Keyboard shortcuts

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