internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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

func DateToUnix(d string) (int64, error)

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.

func DefaultTo

func DefaultTo() string

DefaultTo returns today's date in YYYY-MM-DD format.

func Fatal

func Fatal(msg string, args ...any)

Fatal prints a formatted error message to stderr and exits with code 1.

func ParseDate

func ParseDate(d string) (string, error)

ParseDate validates a YYYY-MM-DD formatted date string.

func PrintJSON

func PrintJSON(v any, raw bool) error

PrintJSON writes v as JSON to stdout. If raw is true, output is compact; otherwise it is indented for readability.

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

func NewClient() (*Client, error)

NewClient creates a new Yahoo Finance API client. It fetches the authentication crumb required for subsequent API calls.

func (*Client) Get

func (c *Client) Get(path string, params url.Values) (json.RawMessage, error)

Get performs a GET request to the Yahoo Finance API. It adds the crumb parameter and retries once if authentication fails.

func (*Client) GetChart

func (c *Client) GetChart(symbol string, params url.Values) (json.RawMessage, error)

GetChart fetches historical OHLCV data for a symbol.

func (*Client) GetOptions

func (c *Client) GetOptions(symbol string, params url.Values) (json.RawMessage, error)

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

func (c *Client) GetQuoteSummary(symbol string, modules []string) (json.RawMessage, error)

GetQuoteSummary fetches quote summary data for a symbol with specified modules.

func (*Client) GetSearch

func (c *Client) GetSearch(query string, params url.Values) (json.RawMessage, error)

GetSearch searches for securities matching the given query.

Jump to

Keyboard shortcuts

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