feat: v0.3 — get_asset_profile/1 and get_dividend_history/2#5
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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}}viaquoteSummary?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'sevents=divstream;:rangeoption 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_quoteswere refactored onto it (no behavior change — the existing retry tests still pass) and the HTTP call generalized toauthed_get/3.Tests
4 new (14 total, green), via the same
Req.Testfull-stack stubs as the rest: profile success, the blank-sector fund case, unsorted-events sorting + malformed-entry dropping (with an assertion thatevents=divis actually sent), and the no-dividends{:ok, []}case.🤖 Generated with Claude Code