Elixir client for Yahoo! Finance.
v0.1 ships the smallest useful surface — a single-symbol quote fetch
via Yahoo's /v7/finance/quote endpoint, with the cookie + CSRF crumb
auth dance handled transparently by YahooFinanceEx.Session. Batched
quotes, FX rates, dividend history, and symbol search are planned
follow-ups.
Quickstart
{:ok, quote} = YahooFinanceEx.get_quote("AAPL")
quote.price
#=> 187.42All HTTP calls go through Req, so tests can
stub responses via Req.Test.stub/2.
Notes
Yahoo's API is unofficial. Endpoints, auth requirements, and response shapes can change without notice. Two auth strategies are tried in order before erroring; sessions live for 60 seconds before being re-fetched.
Summary
Functions
Fetches a single stock quote.
Types
@type error() :: {:auth_failed, term()} | {:http_status, non_neg_integer()} | {:transport, term()} | :not_found
Errors returned by the public functions.
Functions
@spec get_quote(String.t()) :: {:ok, YahooFinanceEx.Quote.t()} | {:error, error()}
Fetches a single stock quote.
Returns {:ok, %YahooFinanceEx.Quote{}} on success, or {:error, reason}
with one of the error/0 shapes on failure.
Retries once on transient auth errors (Yahoo invalidates sessions occasionally); deeper failures bubble up.