stock

package
v0.0.0-...-6c4cad4 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StockInfoType     InfoType = "type"
	StockInfoSector            = "sector"
	StockInfoIndustry          = "industry"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Finder

type Finder interface {
	FindAll() ([]*Stock, error)
	FindByID(ID uuid.UUID) (*Stock, error)
	FindBySymbol(symbol string) (*Stock, error)
	FindByName(name string) (*Stock, error)
	FindAllByExchanges(exchanges []string) ([]*Stock, error)
	FindAllByDividendAnnounceProjectYearAndMonth(year, month int) ([]*Stock, error)
}

type Info

type Info struct {
	ID   uuid.UUID
	Type InfoType
	Name string
}

func NewStockInfo

func NewStockInfo(name string, t InfoType) *Info

NewStockInfo creates an stock info instance

type InfoFinder

type InfoFinder interface {
	FindByName(name string) (*Info, error)
}

type InfoPersister

type InfoPersister interface {
	Persist(i *Info) error
}

type InfoType

type InfoType string

type Persister

type Persister interface {
	PersistAll(ss []*Stock) error
	UpdatePrice(s *Stock) error
	UpdateDividendYield(s *Stock) error
	UpdateHighLow52WeekPrice(s *Stock) error
	UpdatePriceVolatility(s *Stock) error
}

type Price

type Price struct {
	Date       time.Time
	Close      float64
	High       float64
	Low        float64
	Open       float64
	Change     float64
	Volume     int64
	High52Week float64
	Low52Week  float64
	EPS        float64
	PER        float64
}

Price represents stock's price struct

type Price52WeekHighLow

type Price52WeekHighLow struct {
	High52Week float64
	Low52Week  float64
}

Price52WeekHighLow represents 52 week high -low stock's price struct

type PriceVolatility

type PriceVolatility struct {
	Date     time.Time
	HV20Day  float64
	HV52Week float64
}

PriceVolatility represents stock's price volatility struct

type Stock

type Stock struct {
	ID                    uuid.UUID
	Market                *market.Market
	Exchange              *exchange.Exchange
	Name                  string
	Symbol                string
	Value                 mm.Value
	Dividends             []dividend.StockDividend
	DividendYield         float64
	Change                mm.Value
	LastPriceUpdate       time.Time
	High52Week            mm.Value
	Low52Week             mm.Value
	HighLow52WeekUpdate   time.Time
	Type                  *Info
	Sector                *Info
	Industry              *Info
	EPS                   float64
	PER                   float64
	Description           string
	PriceVolatilityUpdate time.Time
	HV20Day               float64
	HV52Week              float64
}

Stock represents stock struct

func NewStock

func NewStock(market *market.Market, exchange *exchange.Exchange, name, symbol string, t, sector, industry *Info) *Stock

NewStock creates an stock instance

func NewStockFromSymbol

func NewStockFromSymbol(market *market.Market, exchange *exchange.Exchange, symbol string) *Stock

NewStockFromSymbol creates an stock instance only with the symbol

func (*Stock) BuyUnder

func (s *Stock) BuyUnder() mm.Value

BuyUnder Price proposal when is appropriate to buy the stock

func (*Stock) ComparePriceWithHighLow

func (s *Stock) ComparePriceWithHighLow() int

ComparePriceWithHighLow Compare price with stock high - low price and returns 1 - Price between 71% - 100% 0 - Price between 31% - 70% -1 - Price between 0% - 30%

func (*Stock) Equals

func (s *Stock) Equals(stk *Stock) bool

type Summary

type Summary struct {
	Name        string
	Description string
	Type        string
	Sector      string
	Industry    string
}

Summary represents stock's summary struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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