Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a struct that represents a Yahoo Finance client
func (*Client) GetSecurityData ¶
func (c *Client) GetSecurityData(ticker string, startDate, endDate time.Time, field Field) ([]*Price, error)
GetSecurityData returns a slice of pointers to Price structs, based on the data received from yahoo
func (*Client) GetSecurityDataString ¶
func (c *Client) GetSecurityDataString(ticker string, startDate, endDate time.Time, field Field) (string, error)
GetSecurityDataString returns the raw response data from the yahoo endpoint. This string will be CSV formatted if the request succeeds. In the event of a failed request, this string will be JSON-formatted
type DateTime ¶
DateTime is a custom implementation of time.Time used to unmarshal yahoo csv data
func (*DateTime) UnmarshalCSV ¶
UnmarshalCSV converts the CSV string as internal date
type ErrorDescription ¶
ErrorDescription is used to deserialize additional error information from yahoo's server
type Field ¶
type Field string
Field represents the type of data that is being requested from the yahoo api
type Price ¶
type Price struct { Date DateTime `csv:"Date"` Open float64 `csv:"Open"` High float64 `csv:"High"` Low float64 `csv:"Low"` Close float64 `csv:"Close"` AdjClose float64 `csv:"Adj Close"` Volume float64 `csv:"Volume"` }
Price represents a single datapoint returned by the yahoo api
type ServerError ¶
type ServerError struct { Result interface{} `json:"result"` Error ErrorDescription `json:"error"` }
ServerError is used to deserialize non-200 responses from yahoo's server
type ServerErrorRoot ¶
type ServerErrorRoot struct {
Chart ServerError `json:"chart"`
}
ServerErrorRoot is the root object returned by yahoo's server on errors