Skip to content

feat: v0.3 — get_asset_profile/1 and get_dividend_history/2#5

Merged
fleveque merged 1 commit into
mainfrom
feat/v0.3-asset-profile-dividend-history
Jun 11, 2026
Merged

feat: v0.3 — get_asset_profile/1 and get_dividend_history/2#5
fleveque merged 1 commit into
mainfrom
feat/v0.3-asset-profile-dividend-history

Conversation

@fleveque

Copy link
Copy Markdown
Owner

Summary

The two endpoints the quantic monolith is waiting on — together they unlock three features whose slots are already built: sector classification for newly-added stocks, forward dividend projections on the chart, and the missing-months factor + 5th rating sub-score on /buy-plan.

API

  • get_asset_profile/1{:ok, %{sector, industry}} via quoteSummary?modules=assetProfile. Funds/ETFs come back {:error, :not_found} — Yahoo signals "no profile" both by omission and by a blank sector string, and both map to not-found (Ruby-client parity).
  • get_dividend_history/2{:ok, [%{date: Date, amount: float}]} date-sorted, via the chart endpoint's events=div stream; :range option defaults to "2y" (a quarterly pattern seen twice). Malformed entries are dropped. Schedule inference deliberately stays consumer-side — the package ships data, not opinions.

Internals

The 401-retry dance was about to reach copies 3 and 4, so it's now a shared with_auth_retry/2; get_quote/get_quotes were refactored onto it (no behavior change — the existing retry tests still pass) and the HTTP call generalized to authed_get/3.

Tests

4 new (14 total, green), via the same Req.Test full-stack stubs as the rest: profile success, the blank-sector fund case, unsorted-events sorting + malformed-entry dropping (with an assertion that events=div is actually sent), and the no-dividends {:ok, []} case.

🤖 Generated with Claude Code

Two endpoints ported from the Ruby yahoo_finance_client:

- get_asset_profile/1: sector + industry via quoteSummary's
  assetProfile module. Funds/ETFs (no profile, or a blank sector —
  Yahoo does both) are {:error, :not_found}, matching the Ruby
  client's nil.
- get_dividend_history/2: per-payment history via the chart endpoint's
  events=div stream, date-sorted ascending, malformed entries dropped;
  :range option (default "2y" — enough to see a quarterly pattern
  twice). Payment-schedule inference stays consumer-side: the package
  ships data, not opinions.

The 401-retry dance was about to be copy n.3 and n.4, so it's now a
shared with_auth_retry/2 — get_quote and get_quotes refactored onto
it (behavior unchanged, covered by the existing retry tests) — and
the quote request generalized to an authed_get/3 all endpoints share.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@fleveque fleveque merged commit b448f29 into main Jun 11, 2026
1 check passed
@fleveque fleveque deleted the feat/v0.3-asset-profile-dividend-history branch June 11, 2026 20:24
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