Documentation
¶
Index ¶
Constants ¶
const (
// DateFormat for yahoo finance api
DateFormat = "2006-01-02"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type History ¶
type History struct { IYApi // contains filtered or unexported fields }
History is the object to manage history api
func (*History) GetHistory ¶
GetHistory can be used to get the history values of a finance stock
history.GetHistory("GOOG", startDate, endDate)
Returns an array with the stock values for the corresponding period
type HistoryAPI ¶
type HistoryAPI interface {
GetHistory(symbol string, start time.Time, end time.Time) ([]Stock, error)
}
HistoryAPI allows to retrieve stocks history
func NewHistory ¶
func NewHistory() HistoryAPI
NewHistory creates a new History api object
Return the new history api object
func NewHistoryTest ¶
func NewHistoryTest(mockHistory IYApi) HistoryAPI
NewHistoryTest create an new history api object for test
Returns the new history api test object
type HistoryQuery ¶
type HistoryQuery struct { Count int `json:"count"` Results HistoryResults `json:"results"` }
HistoryQuery contains the data of an history query
type HistoryResponse ¶
type HistoryResponse struct {
Query HistoryQuery `json:"query"`
}
HistoryResponse is the response of the history query
type HistoryResults ¶
type HistoryResults struct {
Stocks []Stock `json:"quote"`
}
HistoryResults represents the results of an history query
type Quote ¶
type Quote struct { Symbol string `json:"symbol"` Name string `json:"Name"` LastTradePriceOnly float32 `json:"LastTradePriceOnly,string"` FiftydayMovingAverage float32 `json:"FiftydayMovingAverage,string"` TwoHundreddayMovingAverage float32 `json:"TwoHundreddayMovingAverage,string"` Volume int32 `json:"Volume,string"` }
Quote represents a quote on yahoo api
type Quotes ¶
type Quotes struct { IYApi // contains filtered or unexported fields }
Quotes allows user to access yahoo finance quotes api
type QuotesQuery ¶
type QuotesQuery struct { Count int `json:"count"` Results QuotesResults `json:"results"` }
QuotesQuery contains the data of a quotes query
type QuotesResponse ¶
type QuotesResponse struct {
Query QuotesQuery `json:"query"`
}
QuotesResponse is the response of the quotes query
type QuotesResults ¶
type QuotesResults struct {
Quote Quote `json:"quote"`
}
QuotesResults represents the results of an history query
type Stock ¶
type Stock struct { Date YTime `json:"Date,string"` Open float32 `json:"Open,string"` High float32 `json:"High,string"` Low float32 `json:"Low,string"` Close float32 `json:"Close,string"` Volume int `json:"Volume,string"` Symbol string `json:"Symbol"` }
Stock is an object containing stock values
type YApi ¶
type YApi struct {
// contains filtered or unexported fields
}
YApi is the yahoo finance api
func NewYApi ¶
func NewYApi() *YApi
NewYApi create a new yahoo finance api object
Returns the new api object
func NewYApiTest ¶
NewYApiTest create a new yahoo finance api test object
Returns the new api object
type YApiError ¶
type YApiError struct {
Content YApiErrorContent `json:"error"`
}
YApiError represents a yahoo api error
type YApiErrorContent ¶
YApiErrorContent represents the content a yahoo api error
type YTime ¶
YTime represents a date in yahoo finance api
func (*YTime) MarshalJSON ¶
MarshalJSON encode a date from yahoo api
func (*YTime) UnmarshalJSON ¶
UnmarshalJSON decode a date from yahoo api