Documentation
¶
Index ¶
- func CheckRateLimit() error
- func DateToUnix(d string) (int64, error)
- func DefaultFrom() string
- func DefaultTo() string
- func Fatal(msg string, args ...any)
- func ParseDate(d string) (string, error)
- func PrintJSON(v any, raw bool) error
- type Client
- func (c *Client) Get(path string, params url.Values) (json.RawMessage, error)
- func (c *Client) GetChart(symbol string, params url.Values) (json.RawMessage, error)
- func (c *Client) GetOptions(symbol string, params url.Values) (json.RawMessage, error)
- func (c *Client) GetQuote(symbols string) (json.RawMessage, error)
- func (c *Client) GetQuoteSummary(symbol string, modules []string) (json.RawMessage, error)
- func (c *Client) GetSearch(query string, params url.Values) (json.RawMessage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRateLimit ¶
func CheckRateLimit() error
CheckRateLimit verifies that we haven't exceeded the rate limit. It records the current request timestamp and returns an error if the limit is exceeded.
func DateToUnix ¶
DateToUnix parses a YYYY-MM-DD date string and returns a Unix timestamp.
func DefaultFrom ¶
func DefaultFrom() string
DefaultFrom returns the date 30 days ago in YYYY-MM-DD format.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client for the Yahoo Finance API. It handles cookie-based authentication and automatic crumb management.
func NewClient ¶
NewClient creates a new Yahoo Finance API client. It fetches the authentication crumb required for subsequent API calls.
func (*Client) Get ¶
Get performs a GET request to the Yahoo Finance API. It adds the crumb parameter and retries once if authentication fails.
func (*Client) GetOptions ¶
GetOptions fetches options chain data for a symbol.
func (*Client) GetQuote ¶
func (c *Client) GetQuote(symbols string) (json.RawMessage, error)
GetQuote fetches real-time quotes for one or more symbols.
func (*Client) GetQuoteSummary ¶
GetQuoteSummary fetches quote summary data for a symbol with specified modules.