Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // YahooNotFoundCode define errors raised by yahoo finace on code not found YahooNotFoundCode = "Not Found" // ErrYahooSymbolNotFound define errors raised by yahoo finace on symblo not found ErrYahooSymbolNotFound = errors.New("symbol not foud") // ErrYahooInvalidTradingPeroid define errors raised by yahoo invalid trading peroid ErrYahooInvalidTradingPeroid = errors.New("invalid trading peroid") )
Functions ¶
This section is empty.
Types ¶
type Company ¶
Company define company
type CompanyDailyQuote ¶ added in v0.3.0
type CompanyDailyQuote struct { Company *Company Dividend *Dividend Split *Split Pre *Serial Regular *Serial Post *Serial }
CompanyDailyQuote define company daily quote
func (*CompanyDailyQuote) Decode ¶ added in v0.3.0
func (q *CompanyDailyQuote) Decode(r io.Reader) error
Decode decode company daily quote from io.Reader
func (CompanyDailyQuote) Encode ¶ added in v0.3.0
func (q CompanyDailyQuote) Encode(w io.Writer) error
Encode encode company daily quote to io.Writer
func (CompanyDailyQuote) Equal ¶ added in v0.3.0
func (q CompanyDailyQuote) Equal(s CompanyDailyQuote) error
Equal check company daily quote is equal
func (CompanyDailyQuote) IsEmpty ¶ added in v0.3.2
func (q CompanyDailyQuote) IsEmpty() bool
IsEmpty check if company daily quote is empty
type CompanyMap ¶ added in v0.3.1
CompanyMap define company map
type Dividend ¶
Dividend define stock dividend
type ExchangeDailyQuote ¶
type ExchangeDailyQuote struct { Exchange string Date time.Time Companies map[string]*Company Quotes map[string]*CompanyDailyQuote }
ExchangeDailyQuote define exchange daily quote
func (*ExchangeDailyQuote) Decode ¶
func (q *ExchangeDailyQuote) Decode(r io.Reader) error
Decode decode exchange daily quote from io.Reader
func (ExchangeDailyQuote) Encode ¶
func (q ExchangeDailyQuote) Encode(w io.Writer) error
Encode encode exchange daily quote to io.Writer
func (ExchangeDailyQuote) Equal ¶
func (q ExchangeDailyQuote) Equal(s ExchangeDailyQuote) error
Equal check exchange daily quote is equal
func (ExchangeDailyQuote) IsEmpty ¶ added in v0.3.2
func (q ExchangeDailyQuote) IsEmpty() bool
IsEmpty check if exchange daily quote is empty
type Quote ¶
type Quote struct { Timestamp uint64 Open float32 Close float32 High float32 Low float32 Volume uint64 }
Quote define stock quote
type Serial ¶
type Serial []Quote
Serial define quotes
type SerialType ¶
type SerialType int
SerialType define quotes type
const ( // SerialTypePre before trading peroid SerialTypePre SerialType = iota + 1 // SerialTypeRegular in the trading peroid SerialTypeRegular // SerialTypePost after trading peroid SerialTypePost )
func (SerialType) String ¶
func (t SerialType) String() string
type TradingPeroid1 ¶ added in v0.6.2
type TradingPeroid1 [][]YahooPeroid
TradingPeroid1 define trading peroid
type TradingPeroid2 ¶ added in v0.6.2
type TradingPeroid2 struct { Pre [][]YahooPeroid `json:"pre"` Regular [][]YahooPeroid `json:"regular"` Post [][]YahooPeroid `json:"post"` }
TradingPeroid2 define trading peroid
type YahooDividend ¶
YahooDividend define stock dividend
type YahooPeroid ¶
type YahooPeroid struct { Timezone string `json:"timezone"` Start uint64 `json:"start"` End uint64 `json:"end"` GMTOffset int64 `json:"gmtoffset"` }
YahooPeroid define trading peroid
type YahooQuote ¶
type YahooQuote struct { Chart struct { Result []struct { Meta struct { Currency string `json:"currency"` Symbol string `json:"symbol"` ExchangeName string `json:"exchangeName"` InstrumentType string `json:"instrumentType"` FirstTradeDate int64 `json:"firstTradeDate"` GMTOffset int64 `json:"gmtoffset"` Timezone string `json:"timezone"` PreviousClose float32 `json:"previousClose"` Scale int `json:"scale"` CurrentTradingPeriod struct { Pre YahooPeroid `json:"pre"` Regular YahooPeroid `json:"regular"` Post YahooPeroid `json:"post"` } `json:"currentTradingPeriod"` TradingPeriods json.RawMessage `json:"tradingPeriods"` DataGranularity string `json:"dataGranularity"` ValidRanges []string `json:"validRanges"` } `json:"meta"` Timestamp []uint64 `json:"timestamp"` Events struct { Dividends map[uint64]YahooDividend `json:"dividends"` Splits map[uint64]YahooSplits `json:"splits"` } `json:"events"` Indicators struct { Quotes []struct { Open []float32 `json:"open"` Close []float32 `json:"close"` High []float32 `json:"high"` Low []float32 `json:"low"` Volume []uint64 `json:"volume"` } `json:"quote"` } `json:"indicators"` } `json:"result"` Err *struct { Code string `json:"code"` Description string `json:"description"` } `json:"error"` } `json:"chart"` }
YahooQuote define yahoo finace response structure
func (YahooQuote) ToCompanyDailyQuote ¶
func (q YahooQuote) ToCompanyDailyQuote(company *Company, start, end uint64) *CompanyDailyQuote
ToCompanyDailyQuote convert yahoo finance response to company daily quote
func (YahooQuote) Validate ¶
func (q YahooQuote) Validate() error
Validate validate response is valid