Skip to content

feat(market-ports): 0.21.0 -- adapters.financedatabase (INSTRUMENTS) + Instrument reference data (AD-14) - #106

Merged
mjdevaccount merged 3 commits into
basefrom
feat/market-ports-financedatabase
Dec 4, 2026
Merged

mjdevaccount merged 3 commits into
basefrom
feat/market-ports-financedatabase

Conversation

@mjdevaccount

Copy link
Copy Markdown
Owner

market-ports 0.21.0 — adapters.financedatabase (library-placement AD-14, groundwork half)

Instrument contract change (first): Instrument gains optional reference text fields — currency, country, state, city, sector, industry_group, industry, category_group, category, family, market, market_cap_class (a size label, never a number), isin, website, summary. Optional fields on the existing row (not a second row type): INSTRUMENTS already promises Instrument, and "unknown is None" is the models module's own convention.

The adapter ([reference] extra: financedatabase, polars), first implementation of the unused Capability.INSTRUMENTS / InstrumentsQuery port, in the built-in roster:

  • first class that lists a symbol wins (equities, ETFs, indices, funds, currencies, cryptos); a duplicate inside one class answers with its first row; delisted excluded (library default)
  • a symbol no class lists → InstrumentStatus not_found, never an empty success
  • a class that fails to load → VendorError, nothing partial cached, so not_found always means every class was searched
  • load once per fetcher, off the loop, under a lock; only mapped columns kept (~130 MB as Polars frames on financedatabase 2.5.2, vs ~288 MB for the pandas frames the consumer held before)
  • the library downloads its files from GitHub on first use and caches them itself (it is NOT network-free); its retired funds class warns on load and the adapter does not hide that

Symbol now also accepts = (currency pairs like EURUSD=X).

Library checked: financedatabase's own public select(as_pandas=False); its search is a substring match over all columns, not an exact lookup.

Tests

  • recorded cases (financedatabase/cases/instruments.json, recorded through the fetcher's own lookup on 2.5.2): one symbol per class + an unknown; blank/nan/None cells; two drift cases
  • unit: first-hit order, duplicate rows, load-once (sequential and 6-thread race), failed load is VendorError and retries, missing extra is ImportError
  • live smoke (MARKET_PORTS_LIVE=1): passed locally
  • local: market-ports suite 1174 passed; workspace tests/ green; ruff, format, lint-imports, vulture, mypy, pyright verifytypes 100%

🤖 Generated with Claude Code

…TRUMENTS adapter; Instrument reference data

The [reference] extra (financedatabase, polars) serves Capability.INSTRUMENTS: one Instrument per
symbol from the first of equities, ETFs, indices, funds, currencies, cryptos that lists it, an
InstrumentStatus not_found for one none lists, and a VendorError (nothing partial kept) when a
class cannot load, so not_found always means every class was searched. Classes load once per
fetcher, off the loop, under a lock, keeping only the mapped columns (~130 MB as Polars frames).

Instrument gains optional reference fields (currency, country, state, city, sector,
industry_group, industry, category_group, category, family, market, market_cap_class, isin,
website, summary). Symbol also accepts '=' (EURUSD=X).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mjdevaccount
mjdevaccount enabled auto-merge (squash) December 3, 2026 23:52
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mjdev-edge-bot mjdev-edge-bot Bot added the conflict pr-autoupdate: conflicts with main (dedup state for the page) label Dec 3, 2026
@mjdevaccount
mjdevaccount merged commit 178a44d into base Dec 4, 2026
28 checks passed
@mjdevaccount
mjdevaccount deleted the feat/market-ports-financedatabase branch December 4, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict pr-autoupdate: conflicts with main (dedup state for the page)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants