Skip to content

Disambiguate tickers by exchange and add companies resolve - #12

Merged
arcaputo3 merged 1 commit into
gh-6-expand-company-joinfrom
gh-5-ticker-resolution
Aug 5, 2026
Merged

Disambiguate tickers by exchange and add companies resolve#12
arcaputo3 merged 1 commit into
gh-6-expand-company-joinfrom
gh-5-ticker-resolution

Conversation

@arcaputo3

Copy link
Copy Markdown
Contributor

Closes #5. Stacked on #11 (review the last commit only).

The collisions are real

Reproduced against the live API, unprompted:

$ quartr companies resolve CE
id     name                     country  matchedTickers
5977   Celanese Corporation     US       NYSE:CE
16679  Credito Emiliano S.p.A.  IT       BIT:CE
16930  Cortus Energy            SE       OM:CE

$ quartr companies resolve BLD
id     name           country  matchedTickers
11909  TopBuild Corp  US       NYSE:BLD
14573  Boral Limited  AU       ASX:BLD

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 the EXCHANGE:TICKER pairs 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:

$ quartr companies resolve 0001061630
id     name                           country  matchedTickers
10769  Blackstone Mortgage Trust Inc  US       NYSE:BXMT

Name search is not possible. /companies has no search, query, or name parameter — all three return 400 property ... should not exist. Rather than pretend, an argument containing a space is rejected with that explanation:

$ quartr companies resolve "Apple Inc"
the Quartr API has no company name search; pass a ticker (BLD or NYSE:BLD) or a CIK

2. --tickers EXCHANGE:TICKER

When any entry is qualified, the CLI resolves the whole list to companyIds before issuing the real request:

$ quartr --debug events list --tickers NYSE:BLD --limit 4
GET /companies?limit=500&tickers=BLD
GET /events?companyIds=11909&limit=4

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 --limit and pagination stay meaningful. It is the same recipe the issue documents, just automated.

Qualifiers are per entry (--tickers AAPL,NYSE:BLD is fine). No match is a usage error pointing at resolve, not an empty table:

$ quartr events list --tickers NASDAQ:BLD
no company matches NASDAQ:BLD; run `quartr companies resolve BLD` to see the candidates

3. Deduplication

Comma-separated filter values are deduped case-insensitively (--tickers AAPL,aapl,MSFT,AAPLtickers=AAPL,MSFT). Note: I could not reproduce the reported hard error on duplicates — --tickers AAPL,AAPL returns 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-ids and --ids both feed ids and the second Set silently discarded the first. They now merge.

Not done

An --exchange filter that works without a ticker. exchanges is already a supported API parameter, so --exchanges NYSE already works; the gap the issue describes is specifically ticker disambiguation, which EXCHANGE:TICKER covers precisely.

🤖 Generated with Claude Code

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>
@arcaputo3
arcaputo3 merged commit ad694a1 into main Aug 5, 2026
1 check passed
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.

Ticker filtering is collision-prone across exchanges; no name search; duplicate tickers error out

1 participant