Disambiguate tickers by exchange and add companies resolve - #12
Merged
Conversation
Quartr matches a ticker across every exchange, so --tickers CE returns Celanese, Credito Emiliano and Cortus Energy interleaved, and --tickers BLD mixes TopBuild with Boral. Nothing in the output said so. Three changes: `companies resolve <ticker|cik>` prints every candidate with the EXCHANGE:TICKER pairs that matched, turning the two-call recipe (companies list, eyeball, events list --company-ids) into one step. The API has no search/query/name parameter — verified, all three 400 — so an argument with a space is rejected with that explanation instead of a confusing empty result. --tickers now accepts EXCHANGE:TICKER. When any entry is qualified the CLI resolves the whole list to companyIds before issuing the real request. Resolving up front rather than filtering the response is deliberate: rows from the wrong company still count against --limit, so post-filtering can push the company you asked for off the page entirely. Comma-separated filter values are deduplicated case-insensitively. While here: on `companies list`, --company-ids and --ids both feed the `ids` parameter and the second Set silently discarded the first; they now merge. Closes #5 Co-Authored-By: Claude Opus 5 (1M context) <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.
Closes #5. Stacked on #11 (review the last commit only).
The collisions are real
Reproduced against the live API, unprompted:
1.
companies resolve <ticker|cik>One step instead of the recipe agents kept rediscovering (
companies list→ eyeball →events list --company-ids). It prints every candidate with theEXCHANGE:TICKERpairs that matched, which is the field that actually distinguishes them.CIKs get the same treatment, and the issue's landmine reproduces exactly — worth knowing that this is the API's answer, not a CLI bug:
Name search is not possible.
/companieshas nosearch,query, ornameparameter — all three return400 property ... should not exist. Rather than pretend, an argument containing a space is rejected with that explanation:2.
--tickers EXCHANGE:TICKERWhen any entry is qualified, the CLI resolves the whole list to
companyIdsbefore issuing the real request:Why resolve instead of filtering the response: rows belonging to the wrong company still count against
--limit. Filter a page of 4 and you may get 1 row back — or 0, with the company you asked for sitting on page 2. Resolving to an id keeps the filter server-side where--limitand pagination stay meaningful. It is the same recipe the issue documents, just automated.Qualifiers are per entry (
--tickers AAPL,NYSE:BLDis fine). No match is a usage error pointing atresolve, not an empty table:3. Deduplication
Comma-separated filter values are deduped case-insensitively (
--tickers AAPL,aapl,MSFT,AAPL→tickers=AAPL,MSFT). Note: I could not reproduce the reported hard error on duplicates —--tickers AAPL,AAPLreturns 200 today — but deduping makes hand-built lists idempotent regardless. Only list-valued parameters are touched; a cursor is opaque and may legitimately contain a comma.While in there: on
companies list,--company-idsand--idsboth feedidsand the secondSetsilently discarded the first. They now merge.Not done
An
--exchangefilter that works without a ticker.exchangesis already a supported API parameter, so--exchanges NYSEalready works; the gap the issue describes is specifically ticker disambiguation, whichEXCHANGE:TICKERcovers precisely.🤖 Generated with Claude Code