models

package
v0.0.0-...-952c1c6 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type DividendEntry

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

type DividendHist

type DividendHist struct {
	Symbol    string
	Dividends []DividendEntry
}

type DividendHistMap

type DividendHistMap map[string]*DividendHist

type Hist

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

func (*Hist) JSON

func (h *Hist) JSON() string

func (*Hist) MovingAverage

func (h *Hist) MovingAverage() float64

type HistEntry

type HistEntry struct {
	Date     utils.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 HistMap

type HistMap map[string]*Hist

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

func (*Quote) GetPrice

func (q *Quote) GetPrice() float64

func (*Quote) IsIncreasing

func (q *Quote) IsIncreasing() bool

True if the Quote is increasing False otherwise

func (*Quote) JSON

func (q *Quote) JSON() string

func (*Quote) SharesToBuy

func (q *Quote) SharesToBuy(txCost, desiredTxCostPerc float64) float64

SharesToBuy gives you the number of shares to buy if you want

  • the transaction cost to be less than a certain percentage

func (*Quote) VariationValue

func (q *Quote) VariationValue() float64

func (*Quote) VariationValuePercent

func (q *Quote) VariationValuePercent() float64

func (*Quote) WouldBuyOrSell

func (q *Quote) WouldBuyOrSell() interface{}

type Quotes

type Quotes map[string]*Quote

Jump to

Keyboard shortcuts

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