Skip to content

feat: v0.2 — batched quotes (get_quotes/1) and FX (get_fx_rate/2)#3

Merged
fleveque merged 1 commit into
mainfrom
feat/v0.2-batched-quotes-and-fx
Jun 8, 2026
Merged

feat: v0.2 — batched quotes (get_quotes/1) and FX (get_fx_rate/2)#3
fleveque merged 1 commit into
mainfrom
feat/v0.2-batched-quotes-and-fx

Conversation

@fleveque

@fleveque fleveque commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Summary

Adds two functions on top of v0.1's single-symbol get_quote/1, both reusing the existing Session + HTTP wrapper.

YahooFinanceEx.get_quotes/1

{:ok, by_symbol} = YahooFinanceEx.get_quotes(["AAPL", "MSFT", "FAKE"])
by_symbol["AAPL"]      #=> {:ok, %YahooFinanceEx.Quote{...}}
by_symbol["FAKE"]      #=> {:error, :not_found}
  • Internally chunks into batches of 50 (Yahoo's per-request ceiling) and merges results across batches.
  • Dedupes the input list.
  • Top-level errors (auth / transport / http_status) abort the whole call and bubble up; partial misses surface inside the result map as {:error, :not_found} for those keys — the top-level call still returns {:ok, map}.

YahooFinanceEx.get_fx_rate/2

{:ok, 1.08} = YahooFinanceEx.get_fx_rate("EUR", "USD")
{:ok, 1.0}  = YahooFinanceEx.get_fx_rate("USD", "USD")  # identity short-circuits, no HTTP

Uses Yahoo's <FROM><TO>=X ticker convention internally. Returns {:ok, rate} as a float().

Bookkeeping

  • Version 0.1.0 → 0.2.0.
  • CHANGELOG.md updated.
  • README.md updated to v0.2 surface, dep snippet bumped to ~> 0.2.
  • Package description tightened.

After merge

Manual step: mix hex.publish to push 0.2.0. The quantic dep bump + live price column lands in a follow-up PR on the quantic repo.

Test plan

  • mix test clean (10 passing — 3 v0.1 + 7 new)
  • mix compile --warnings-as-errors clean
  • CI green

Two new public functions, both reusing the existing Session +
HTTP wrapper so the cookie + crumb auth flow is unchanged.

YahooFinanceEx.get_quotes/1
- Takes a list of symbols; returns {:ok, %{symbol => result}} where
  result is {:ok, Quote.t()} | {:error, :not_found}.
- Internally chunks into batches of 50 (Yahoo's per-request ceiling)
  and merges results across batches.
- Dedupes the input list before requesting.
- Top-level errors (auth, transport, http_status) abort the whole
  call and bubble up; partial misses surface inside the result map.

YahooFinanceEx.get_fx_rate/2
- Uses Yahoo's <FROM><TO>=X ticker convention internally.
- Identity pairs (USD/USD) short-circuit to {:ok, 1.0} without
  hitting the API.
- Returns {:ok, rate} as a float on success.

Version bump 0.1.0 → 0.2.0; README + CHANGELOG updated to match;
package description tightened to reflect actual surface.

7 new tests on top of the 3 existing — 10 passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fleveque fleveque merged commit cad0247 into main Jun 8, 2026
1 check passed
@fleveque fleveque deleted the feat/v0.2-batched-quotes-and-fx branch June 8, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant